From e09281818603c93d0ec91fd6025d485e6cc6cc38 Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Mon, 13 Nov 2023 10:38:30 +1300 Subject: [PATCH 1/2] add apptainer def file and workflow to build it --- .github/workflows/build_container.yml | 30 +++++++++++++++++++++++++++ ML102.def | 16 ++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/build_container.yml create mode 100644 ML102.def diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml new file mode 100644 index 0000000..bb458be --- /dev/null +++ b/.github/workflows/build_container.yml @@ -0,0 +1,30 @@ +name: Build container image + +on: + workflow_dispatch: + push: + +jobs: + build: + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + sudo apt update -y + sudo apt install -y wget + - name: Install Apptainer + run: | + wget https://github.com/apptainer/apptainer/releases/download/v1.2.4/apptainer_1.2.4_amd64.deb + sudo apt install -y ./apptainer_1.2.4_amd64.deb + rm ./apptainer_1.2.4_amd64.deb + - uses: actions/checkout@v4 + - name: Build container + run: sudo apptainer build ML102.sif ML102.def + - name: Login and deploy + run: | + echo ${{ secrets.GITHUB_TOKEN }} | apptainer remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io + apptainer push ML102.sif "oras://ghcr.io/ml102_workshop:latest" + if: ${{ github.ref == 'refs/heads/main' }} diff --git a/ML102.def b/ML102.def new file mode 100644 index 0000000..588a689 --- /dev/null +++ b/ML102.def @@ -0,0 +1,16 @@ +Bootstrap: docker +From: python:3.11-bookworm + +%files + ./ /opt/ml102_workshop/ + +%post + apt-get update && apt-get install -y \ + rsync \ + nano \ + vim \ + git \ + wget \ + curl + pip install -r /opt/ml102_workshop/requirements.lock.txt + pip install jupyterlab From d2e45c3f644e5d4c0316e21b513a1929cdbd3d8a Mon Sep 17 00:00:00 2001 From: Chris Scott Date: Mon, 13 Nov 2023 10:40:58 +1300 Subject: [PATCH 2/2] stick with Python 3.10 in image --- ML102.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ML102.def b/ML102.def index 588a689..37352bc 100644 --- a/ML102.def +++ b/ML102.def @@ -1,5 +1,5 @@ Bootstrap: docker -From: python:3.11-bookworm +From: python:3.10-bookworm %files ./ /opt/ml102_workshop/