Skip to content

Add container image and release build to ghcr #567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/container.yaml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Loading