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.

Part of #27
  • Loading branch information
johnbradley committed Sep 3, 2024
1 parent 12c503d commit 27e36c3
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/deploy-apptainer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create and publish an Apptainer image

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
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 metadata (tags, labels) for Apptainer
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Setup apptainer executable
uses: eWaterCycle/setup-apptainer@v2
with:
apptainer-version: 1.3.0

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

- name: Publish apptainer image
run: apptainer push bioclip.sif oras://ghcr.io/johnbradley/apptainer-test:${{ steps.meta.outputs.version }}
11 changes: 11 additions & 0 deletions apptainer.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Bootstrap: docker
From: condaforge/miniforge3:24.3.0-0

%arguments
PYBIOCLIP_VERSION=

%post
pip install "https://github.com/Imageomics/pybioclip/archive/refs/tags/{{ PYBIOCLIP_VERSION }}.tar.gz" && pip cache purge

%runscript
exec bash

0 comments on commit 27e36c3

Please sign in to comment.