diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..8751399d --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,120 @@ +# This workflow will build two Docker image and push then to GitHub Packages Container registry: +# - a base image with the dependencies +# - a main image with the application code + +name: Docker + +on: + push: + branches: [main] + paths: + - 'docker/**' + - '.github/workflows/docker-base.yml' + - 'conda/*.yml' + - 'pyproject.toml' + pull_request: + branches: [main] + paths: + - 'docker/**' + - '.github/workflows/docker-base.yml' + - 'conda/*.yml' + - 'pyproject.toml' + release: + types: [published] + +jobs: + build_docker_images: + strategy: + matrix: + RAPIDS_VER: + - 24.04 + name: Build Docker images + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + attestations: write + steps: + - name: Maximize build disk space + uses: easimon/maximize-build-space@v10 + with: + remove-dotnet: true + remove-android: true + remove-haskell: true + remove-codeql: true + root-reserve-mb: 35840 + swap-size-mb: 1048 + + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker base image + id: meta-base + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }}-deps + + - name: create yaml file for conda environment + run: | + grep -v -- '- rapids-singlecell' conda/rsc_rapids_${{ matrix.RAPIDS_VER }}.yml > docker/rsc_rapids.yml + shell: bash + + - name: Build and push Docker base images + id: push-base + uses: docker/build-push-action@v5 + with: + context: ./docker/ + file: ./docker/Dockerfile.deps + push: ${{ github.event_name == 'release' }} + tags: ${{ steps.meta-base.outputs.tags }} + labels: ${{ steps.meta-base.outputs.labels }} + #cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-deps + + - name: Generate artifact attestation for base image + if: github.event_name == 'release' + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push-base.outputs.digest }} + push-to-registry: true + + - name: Extract metadata (tags, labels) for main Docker image + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }} + + - name: Build and push main Docker images + id: push + uses: docker/build-push-action@v5 + with: + context: ./docker/ + file: ./docker/Dockerfile + push: ${{ github.event_name == 'release' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + #cache-from: type=registry,ref=ghcr.io/${{ github.repository }} + build-contexts: | + rapids-singlecell-deps=docker-image://${{ steps.meta-base.outputs.tags }} + + - name: Generate artifact attestation for main image + if: github.event_name == 'release' + uses: actions/attest-build-provenance@v1 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} + subject-digest: ${{ steps.push.outputs.digest }} + push-to-registry: true + + - name: list docker images + run: | + docker image ls -a + shell: bash diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..507c13b2 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,20 @@ +FROM rapids-singlecell-deps + +ARG GIT_ID=main + +SHELL ["/bin/bash", "-euo", "pipefail", "-c"] + +ENV PATH=/opt/conda/bin:$PATH + +RUN < rsc_rapids.yml +docker build -t rapids-singlecell-deps:latest -f docker/Dockerfile.deps . +rm rsc_rapids.yml +docker build -t rapids-singlecell:latest -f docker/Dockerfile . +latest_id=$( docker images |grep -e "rapids-singlecell[ \t]*latest"|head -n1|awk '{print $3}' ) +#docker tag $latest_id $docker_account/rapids-singlecell:latest +#docker push $docker_account/rapids-singlecell:latest diff --git a/docs/release-notes/0.10.3.md b/docs/release-notes/0.10.3.md index 2a474c63..574d0015 100644 --- a/docs/release-notes/0.10.3.md +++ b/docs/release-notes/0.10.3.md @@ -3,6 +3,7 @@ ```{rubric} Features ``` * adds the flavor `seurat_v3_paper` to `pp.highly_variable_genes` {pr}`170` {smaller}`S Dicks` +* build docker images in github CI {pr}`177` {smaller}`T Korten (HZDR/Helmholtz AI)` ```{rubric} Performance ``` @@ -12,6 +13,7 @@ * updates `pp.highly_variable_genes` for the flavors `seurat` and `cell_ranger` {pr}`183` {smaller}`S Dicks` * `pp.scale` now uses `RawKernels` for dense and csr {pr}`185` {smaller}`S Dicks` + ```{rubric} Bug fixes ``` * fixes a bug where the `pp.scale` would have issues with `int64` indexing {pr}`187` {smaller}`S Dicks`