From 50eddf2ec455ea57a61068bb468cfde746633b4a Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Wed, 15 Jul 2026 13:28:10 +0100 Subject: [PATCH 1/2] Add OCI image labels carrying git commit SHA to Docker images Declare the standard OCI labels (revision, source, version, created) in the final image stage of portable.Dockerfile, gpu.Dockerfile and Dockerfile via build args defaulting to unknown, and inject the values from the publish workflows so published images can be mapped back to their source commit. --- .github/workflows/publish-docker-gpu.yaml | 9 +++++++++ .github/workflows/publish-docker.yaml | 9 +++++++++ Dockerfile | 8 ++++++++ gpu.Dockerfile | 8 ++++++++ portable.Dockerfile | 8 ++++++++ 5 files changed, 42 insertions(+) diff --git a/.github/workflows/publish-docker-gpu.yaml b/.github/workflows/publish-docker-gpu.yaml index 9ad834195..25cdaed7e 100644 --- a/.github/workflows/publish-docker-gpu.yaml +++ b/.github/workflows/publish-docker-gpu.yaml @@ -23,6 +23,11 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Compute build metadata + id: buildmeta + run: | + echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" + echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" - name: Build and push Docker image id: docker_build uses: docker/build-push-action@v2 @@ -31,6 +36,10 @@ jobs: platforms: linux/amd64 push: true no-cache: true + build-args: | + GIT_COMMIT=${{ github.sha }} + BUILD_DATE=${{ steps.buildmeta.outputs.date }} + IMAGE_VERSION=${{ steps.buildmeta.outputs.version }} tags: opendronemap/odm:gpu # Trigger NodeODM build - name: Dispatch NodeODM Build Event diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml index 4aafa0265..01d4b9b32 100644 --- a/.github/workflows/publish-docker.yaml +++ b/.github/workflows/publish-docker.yaml @@ -35,6 +35,11 @@ jobs: images: opendronemap/odm tag-semver: | {{version}} + - name: Compute build metadata + id: buildmeta + run: | + echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT" + echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" - name: Build and push Docker image id: docker_build uses: docker/build-push-action@v2 @@ -43,6 +48,10 @@ jobs: platforms: linux/amd64,linux/arm64 push: true no-cache: true + build-args: | + GIT_COMMIT=${{ github.sha }} + BUILD_DATE=${{ steps.buildmeta.outputs.date }} + IMAGE_VERSION=${{ steps.buildmeta.outputs.version }} tags: | ${{ steps.docker_meta.outputs.tags }} opendronemap/odm:latest diff --git a/Dockerfile b/Dockerfile index 70ae94ac9..2b90a0819 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,14 @@ RUN bash configure.sh clean # size of the layers. FROM ubuntu:24.04 +ARG GIT_COMMIT=unknown +ARG BUILD_DATE=unknown +ARG IMAGE_VERSION=unknown +LABEL org.opencontainers.image.revision="$GIT_COMMIT" \ + org.opencontainers.image.source="https://github.com/OpenDroneMap/ODM" \ + org.opencontainers.image.version="$IMAGE_VERSION" \ + org.opencontainers.image.created="$BUILD_DATE" + # Env variables ENV DEBIAN_FRONTEND=noninteractive \ PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/local/lib/python3.12/dist-packages:/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ diff --git a/gpu.Dockerfile b/gpu.Dockerfile index 437d780f6..b53f49b47 100644 --- a/gpu.Dockerfile +++ b/gpu.Dockerfile @@ -27,6 +27,14 @@ RUN bash configure.sh clean # size of the layers. FROM nvidia/cuda:12.9.1-runtime-ubuntu24.04 +ARG GIT_COMMIT=unknown +ARG BUILD_DATE=unknown +ARG IMAGE_VERSION=unknown +LABEL org.opencontainers.image.revision="$GIT_COMMIT" \ + org.opencontainers.image.source="https://github.com/OpenDroneMap/ODM" \ + org.opencontainers.image.version="$IMAGE_VERSION" \ + org.opencontainers.image.created="$BUILD_DATE" + # Env variables ENV DEBIAN_FRONTEND=noninteractive \ PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/local/lib/python3.12/dist-packages:/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ diff --git a/portable.Dockerfile b/portable.Dockerfile index 27c459a0d..c407524ca 100644 --- a/portable.Dockerfile +++ b/portable.Dockerfile @@ -27,6 +27,14 @@ RUN bash configure.sh clean # size of the layers. FROM ubuntu:24.04 +ARG GIT_COMMIT=unknown +ARG BUILD_DATE=unknown +ARG IMAGE_VERSION=unknown +LABEL org.opencontainers.image.revision="$GIT_COMMIT" \ + org.opencontainers.image.source="https://github.com/OpenDroneMap/ODM" \ + org.opencontainers.image.version="$IMAGE_VERSION" \ + org.opencontainers.image.created="$BUILD_DATE" + # Env variables ENV DEBIAN_FRONTEND=noninteractive \ PYTHONPATH="$PYTHONPATH:/code/SuperBuild/install/local/lib/python3.12/dist-packages:/code/SuperBuild/install/lib/python3.12/dist-packages:/code/SuperBuild/install/bin/opensfm" \ From 12b133cd25ad775961e93c315665e291bccde764 Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Wed, 15 Jul 2026 15:48:28 +0100 Subject: [PATCH 2/2] Add static OCI descriptive labels to Docker images Add the static title, description, url, documentation, licenses and vendor OCI image labels to the final image stage of portable.Dockerfile, gpu.Dockerfile and Dockerfile. --- Dockerfile | 8 +++++++- gpu.Dockerfile | 8 +++++++- portable.Dockerfile | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b90a0819..c53164205 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,13 @@ ARG IMAGE_VERSION=unknown LABEL org.opencontainers.image.revision="$GIT_COMMIT" \ org.opencontainers.image.source="https://github.com/OpenDroneMap/ODM" \ org.opencontainers.image.version="$IMAGE_VERSION" \ - org.opencontainers.image.created="$BUILD_DATE" + org.opencontainers.image.created="$BUILD_DATE" \ + org.opencontainers.image.title="OpenDroneMap" \ + org.opencontainers.image.description="Command line toolkit for processing aerial drone imagery" \ + org.opencontainers.image.url="https://www.opendronemap.org" \ + org.opencontainers.image.documentation="https://docs.opendronemap.org" \ + org.opencontainers.image.licenses="AGPL-3.0-only" \ + org.opencontainers.image.vendor="OpenDroneMap" # Env variables ENV DEBIAN_FRONTEND=noninteractive \ diff --git a/gpu.Dockerfile b/gpu.Dockerfile index b53f49b47..c1fbe1b38 100644 --- a/gpu.Dockerfile +++ b/gpu.Dockerfile @@ -33,7 +33,13 @@ ARG IMAGE_VERSION=unknown LABEL org.opencontainers.image.revision="$GIT_COMMIT" \ org.opencontainers.image.source="https://github.com/OpenDroneMap/ODM" \ org.opencontainers.image.version="$IMAGE_VERSION" \ - org.opencontainers.image.created="$BUILD_DATE" + org.opencontainers.image.created="$BUILD_DATE" \ + org.opencontainers.image.title="OpenDroneMap" \ + org.opencontainers.image.description="Command line toolkit for processing aerial drone imagery" \ + org.opencontainers.image.url="https://www.opendronemap.org" \ + org.opencontainers.image.documentation="https://docs.opendronemap.org" \ + org.opencontainers.image.licenses="AGPL-3.0-only" \ + org.opencontainers.image.vendor="OpenDroneMap" # Env variables ENV DEBIAN_FRONTEND=noninteractive \ diff --git a/portable.Dockerfile b/portable.Dockerfile index c407524ca..d406c3309 100644 --- a/portable.Dockerfile +++ b/portable.Dockerfile @@ -33,7 +33,13 @@ ARG IMAGE_VERSION=unknown LABEL org.opencontainers.image.revision="$GIT_COMMIT" \ org.opencontainers.image.source="https://github.com/OpenDroneMap/ODM" \ org.opencontainers.image.version="$IMAGE_VERSION" \ - org.opencontainers.image.created="$BUILD_DATE" + org.opencontainers.image.created="$BUILD_DATE" \ + org.opencontainers.image.title="OpenDroneMap" \ + org.opencontainers.image.description="Command line toolkit for processing aerial drone imagery" \ + org.opencontainers.image.url="https://www.opendronemap.org" \ + org.opencontainers.image.documentation="https://docs.opendronemap.org" \ + org.opencontainers.image.licenses="AGPL-3.0-only" \ + org.opencontainers.image.vendor="OpenDroneMap" # Env variables ENV DEBIAN_FRONTEND=noninteractive \