Skip to content

Commit

Permalink
ci: publish singularity image to registry (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyoung84 authored Mar 18, 2024
1 parent 7567d1b commit 9633ebd
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
48 changes: 47 additions & 1 deletion .github/workflows/tag_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: 3.10
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -e .[dev] --no-cache-dir
Expand Down Expand Up @@ -63,3 +63,49 @@ jobs:
uses: AllenNeuralDynamics/aind-github-actions/.github/workflows/tag.yml@main
secrets:
SERVICE_TOKEN: ${{ secrets.SERVICE_TOKEN }}
publish:
runs-on: ubuntu-latest
needs: tag
steps:
- uses: actions/checkout@v3
- name: Pull latest changes
run: git pull origin main
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Install Dependencies
run: |
sudo apt-get update && sudo apt-get install -y \
build-essential \
libssl-dev \
uuid-dev \
libgpgme11-dev \
squashfs-tools \
libseccomp-dev \
pkg-config
- name: Install Singularity
env:
SINGULARITY_VERSION: 3.7.0
GOPATH: /tmp/go
run: |
mkdir -p $GOPATH
sudo mkdir -p /usr/local/var/singularity/mnt && \
mkdir -p $GOPATH/src/github.com/sylabs && \
cd $GOPATH/src/github.com/sylabs && \
wget -qO- https://github.com/sylabs/singularity/releases/download/v${SINGULARITY_VERSION}/singularity-ce-${SINGULARITY_VERSION}.tar.gz | \
tar xzv && \
cd singularity-ce-${SINGULARITY_VERSION} && \
./mconfig -p /usr/local && \
make -C builddir && \
sudo make -C builddir install
- name: Build sif container
run: |
mkdir sudo aind-data-transformation/build
sudo -E singularity build aind-data-transformation/build/container.sif aind-data-transformation/scripts/singularity_build.def
- name: Login and Deploy Container
run: |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ github.actor }} --password-stdin oras://ghcr.io
singularity push aind-data-transformation/build/container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${{ needs.tag.outputs.new_version }}
singularity push aind-data-transformation/build/container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:latest
12 changes: 12 additions & 0 deletions scripts/singularity_build.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Bootstrap: docker
From: python:3.10-bullseye
Stage: build

%setup
# Copy project directory into container
cp -R aind-data-transformation ${SINGULARITY_ROOTFS}/aind-data-transformation

%post
cd ${SINGULARITY_ROOTFS}/aind-data-transformation
pip install .[ephys] --no-cache-dir
rm -rf ${SINGULARITY_ROOTFS}/aind-data-transformation

0 comments on commit 9633ebd

Please sign in to comment.