From 68d33f1e3dd07a9ceb0b4ef6be75939c776b106a Mon Sep 17 00:00:00 2001 From: Yousef Moazzam Date: Wed, 9 Apr 2025 10:53:22 +0100 Subject: [PATCH 1/2] Add Dockerfile --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..1d8488af6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM mambaorg/micromamba:2.0.8-debian12-slim AS build + +USER root + +RUN apt update && apt install -y git && apt clean + +RUN micromamba install -y python=3.11 blas[build=mkl] 'numpy<2' scipy scikit-image tqdm pyyaml pillow click cuda-version=12.8 +RUN micromamba install -y openmpi=4.1.6 mpi +RUN micromamba install -y h5py[build=*openmpi*] hdf5plugin +RUN micromamba install -y mpi4py +RUN micromamba install -y aiofiles graypy imageio loguru pluggy pytest iniconfig +RUN micromamba install -y tomopy=1.15 +RUN micromamba install -y cupy=12.3.0 nvtx +RUN micromamba install -y -c astra-toolbox astra-toolbox +RUN micromamba run python -m pip install ccpi-regularisation-cupy +RUN micromamba run python -m pip install tomobar +RUN micromamba run python -m pip install --no-deps httomolib httomolibgpu httomo-backends +RUN micromamba clean -y --all --force-pkgs-dirs + +COPY . . +RUN micromamba run python -m pip install --no-deps . + +FROM mambaorg/micromamba:cuda12.8.1-ubuntu22.04 AS deploy + +COPY --from=build /opt/conda /opt/conda + +ENTRYPOINT ["micromamba", "run", "python", "-m", "httomo", "run"] From e98c89e45405c47b585ff21605039caa921cd290 Mon Sep 17 00:00:00 2001 From: Yousef Moazzam Date: Wed, 9 Apr 2025 12:54:05 +0100 Subject: [PATCH 2/2] Add github action to build release container image --- .github/workflows/container.yaml | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/container.yaml diff --git a/.github/workflows/container.yaml b/.github/workflows/container.yaml new file mode 100644 index 000000000..f9aa31796 --- /dev/null +++ b/.github/workflows/container.yaml @@ -0,0 +1,47 @@ +name: Build and Push Container Image + +on: + push: + tags: + - v* + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Version from Tag + id: tags + run: echo version=$(echo "${{ github.ref_name }}" | cut -c 2-) >> $GITHUB_OUTPUT + + - name: Docker Metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=raw,value=${{ steps.tags.outputs.version }} + type=raw,value=latest + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and Push Image + uses: docker/build-push-action@v6 + with: + push: true + context: . + tags: ${{ steps.meta.outputs.tags }} + target: deploy