Skip to content

Commit

Permalink
Add apptainer support
Browse files Browse the repository at this point in the history
Adds apptainer definition and config to automatically build the
apptainer image on release. The apptainer image is based on the
docker image.

Part of #27

Co-authored-by: Hilmar Lapp <hlapp@drycafe.net>
  • Loading branch information
johnbradley and hlapp committed Sep 12, 2024
1 parent 12c503d commit 1909a17
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 2 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Create and publish a Docker image

name: Create and publish container images

on:
release:
Expand All @@ -8,7 +9,7 @@ env:
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
build-and-push-docker:
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -43,3 +44,38 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: "PYBIOCLIP_VERSION=${{ steps.meta.outputs.version }}"

build-and-push-apptainer:
runs-on: ubuntu-latest
needs: build-and-push-docker
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version for apptainer build
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Setup apptainer executable
uses: eWaterCycle/setup-apptainer@v2
with:
apptainer-version: 1.3.3

- name: Build an apptainer image
run: apptainer build --build-arg PYBIOCLIP_VERSION=${{ steps.meta.outputs.version }} apptainer.sif apptainer.def

- name: Publish apptainer image
run: apptainer push apptainer.sif oras://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-sif:${{ steps.meta.outputs.version }}
8 changes: 8 additions & 0 deletions apptainer.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bootstrap: docker
From: ghcr.io/imageomics/pybioclip:{{ PYBIOCLIP_VERSION }}

%arguments
PYBIOCLIP_VERSION=

%runscript
exec "$@"

0 comments on commit 1909a17

Please sign in to comment.