From 4c3f65c7a71b679a2ef974191642616d0816ed8a Mon Sep 17 00:00:00 2001 From: Juan Carlos Graciosa Date: Wed, 8 Jul 2026 20:05:42 +1000 Subject: [PATCH 1/2] ci(container): multi-arch support (amd64 + arm64) and version tagging --- .github/workflows/docker-image.yaml | 28 ++++++++++++++++++++++------ container/Containerfile | 7 +++++-- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml index 89708906..9e451552 100644 --- a/.github/workflows/docker-image.yaml +++ b/.github/workflows/docker-image.yaml @@ -23,6 +23,8 @@ on: description: 'Force full rebuild (no cache)' type: boolean default: false + release: + types: [published] jobs: build-and-push: @@ -35,11 +37,23 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Extract branch name - run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + #- name: Extract branch name + # run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/underworldcode/underworld3 + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} - name: Login to GHCR uses: docker/login-action@v3 @@ -54,8 +68,10 @@ jobs: context: . push: true file: container/Containerfile - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 no-cache: ${{ inputs.force_rebuild || false }} - tags: | - ghcr.io/underworldcode/underworld3:${{ env.BRANCH }} - ghcr.io/underworldcode/underworld3:latest + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + # tags: | + # ghcr.io/underworldcode/underworld3:${{ env.BRANCH }} + # ghcr.io/underworldcode/underworld3:latest diff --git a/container/Containerfile b/container/Containerfile index e4233f8e..dc950aa3 100644 --- a/container/Containerfile +++ b/container/Containerfile @@ -37,9 +37,12 @@ RUN micromamba install -y -v -n base -f /tmp/env.yaml && \ # activate mamba env during podman build ARG MAMBA_DOCKERFILE_ACTIVATE=1 -# pyvista - taken from pyvista docker files +# pyvista - vtk-osmesa only available for amd64; arm64 falls back to conda-forge vtk # see https://github.com/pyvista/pyvista/tree/main/docker -RUN pip install --no-cache-dir --extra-index-url https://wheels.vtk.org vtk-osmesa +ARG TARGETARCH +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + pip install --no-cache-dir --extra-index-url https://wheels.vtk.org vtk-osmesa; \ + fi # install UW3 COPY --chown=$MAMBA_USER:$MAMBA_USER \ From 32fa43746296cf4cdc062f9b6aa845f1a90ed9a3 Mon Sep 17 00:00:00 2001 From: Juan Carlos Graciosa Date: Wed, 8 Jul 2026 20:17:17 +1000 Subject: [PATCH 2/2] fix(container): set version from build arg, untrack committed _version.py --- .github/workflows/docker-image.yaml | 2 ++ container/Containerfile | 4 +++- src/underworld3/_version.py | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 src/underworld3/_version.py diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml index 9e451552..3e2d0ca7 100644 --- a/.github/workflows/docker-image.yaml +++ b/.github/workflows/docker-image.yaml @@ -70,6 +70,8 @@ jobs: file: container/Containerfile platforms: linux/amd64,linux/arm64 no-cache: ${{ inputs.force_rebuild || false }} + build-args: | + SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.meta.outputs.version }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} # tags: | diff --git a/container/Containerfile b/container/Containerfile index dc950aa3..c586c03d 100644 --- a/container/Containerfile +++ b/container/Containerfile @@ -49,7 +49,9 @@ COPY --chown=$MAMBA_USER:$MAMBA_USER \ --exclude=**/.git \ . /home/$MAMBA_USER/underworld3 WORKDIR /home/$MAMBA_USER/underworld3 -RUN pip install --no-build-isolation --no-cache-dir . +ARG SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0+unknown +RUN SETUPTOOLS_SCM_PRETEND_VERSION=${SETUPTOOLS_SCM_PRETEND_VERSION} \ + pip install --no-build-isolation --no-cache-dir . # allow jupyterlab for ipyvtk ENV PYVISTA_OFF_SCREEN=true diff --git a/src/underworld3/_version.py b/src/underworld3/_version.py deleted file mode 100644 index 51fa7207..00000000 --- a/src/underworld3/_version.py +++ /dev/null @@ -1,2 +0,0 @@ -## On initial, official release, let __version__ for underworld3 move to 3.0 (of underworld) -__version__ = "0.99.0b"