Skip to content

Add OCI image labels carrying git commit SHA to Docker images#2049

Merged
MJohnson459 merged 2 commits into
OpenDroneMap:masterfrom
MJohnson459:oci-image-labels
Jul 15, 2026
Merged

Add OCI image labels carrying git commit SHA to Docker images#2049
MJohnson459 merged 2 commits into
OpenDroneMap:masterfrom
MJohnson459:oci-image-labels

Conversation

@MJohnson459

Copy link
Copy Markdown
Contributor

Declare the standard OCI labels (revision, source, version, created) in the final image stage of portable.Dockerfile, gpu.Dockerfile and Dockerfile via build args.

These defaulting to unknown as we can't automatically add them from within Docker but we inject the values from the publish workflows so published images can be mapped back to their source commit.

This means the generated docker images will link to the exact version that was built which will make comparisons easier.

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.
push: true
no-cache: true
build-args: |
GIT_COMMIT=${{ github.sha }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sha is probably enough, but for convenience, can we also add "tags"/ commit title?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tag is already attached to the images, just by a different method. A published image will end up as something like OpenDroneMap/ODM:3.6.1. These tags are extra values so we have an unmovable reference to what sha was actually built in that. Looking closer at the OCI labels, we might want a few more of them but I don't see which one would obviously suite a commit title - https://specs.opencontainers.org/image-spec/annotations/. Could always do a custom label but I think we might be able to have everything all link together with the sha and url alone.

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.
@MJohnson459 MJohnson459 merged commit 1a4c154 into OpenDroneMap:master Jul 15, 2026
2 checks passed
@MJohnson459 MJohnson459 deleted the oci-image-labels branch July 15, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants