update apptainer_build.yml #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: starfish apptainer build and push | |
on: | |
push: | |
branches: | |
- main # or any other branch you want to trigger the workflow | |
jobs: | |
apptainer-build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
# Step to set up Apptainer and build the .sif image | |
- name: Build Apptainer Image | |
run: | | |
# Replace with commands to build your Apptainer image | |
sudo apt-get update | |
sudo apt-get install -y build-essential libseccomp-dev pkg-config squashfs-tools cryptsetup | |
# Download and compile Apptainer from source | |
wget https://github.com/apptainer/apptainer/releases/download/v1.2.5/apptainer-1.2.5.tar.gz | |
tar -xzf apptainer-1.2.5.tar.gz | |
cd apptainer-1.2.5 | |
./mconfig && \ | |
make -C ./builddir && \ | |
sudo make -C ./builddir install | |
# Go back to the root of the repository and build .sif | |
cd .. | |
apptainer build starfish.sif apptainer/starfish.def | |
# Step to log in to GitHub Packages | |
- name: Login to GitHub Container Registry | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
# Step to push the image to GitHub Packages | |
- name: Push to GitHub Packages | |
run: | | |
# Set the image tag | |
IMAGE_TAG=ghcr.io/${{ github.repository_owner }}/starfish:${{ github.sha }} | |
# Push the image | |
docker push $IMAGE_TAG |