Skip to content
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

isle-buildkit#377: Add opencontainers annotations for image source, URL #378

Closed
wants to merge 1 commit into from

Conversation

xurizaemon
Copy link
Contributor

Add opencontainers annotations to images

Refs #377

Generated with:

for DOCKERFILE in */Dockerfile ; do DIR=$( dirname $DOCKERFILE ) ; sed -i '3 a LABEL org.opencontainers.image.url=https://github.com/Islandora-DevOps/isle-buildkit/\n' $DOCKERFILE ; sed -i "3 a LABEL org.opencontainers.image.source=https://github.com/Islandora-DevOps/isle-buildkit/tree/main/$DIR" $DOCKERFILE ; done

@xurizaemon
Copy link
Contributor Author

Looks like this could be done via https://docs.docker.com/build/bake/reference/#targetannotations if that's preferred?

@joecorall
Copy link
Contributor

joecorall commented Feb 10, 2025

I think these labels are useful to add and this is a good start. Though I do not think they will help with a changelog in systems like renovate - for that we should work on making better release notes in our GitHub releases and folks using renovate should use their github release data source to get updates.

We probably need to add some build args to populate some of the values in the proposed labels, as the source of the image isn't always the main branch (e.g. when building images off a PR).

@nigelgbanks
Copy link
Contributor

nigelgbanks commented Feb 10, 2025

I'm afraid that using build arguments for annotations like this will invalidate caching and force rebuilds for images that are otherwise identical. I'd prefer to rely on https://docs.docker.com/build/metadata/attestations/slsa-provenance/ as they are not baked into the image and denote many aspects of how the image was built. This is not currently implemented in our build process, but I've tested it locally, and I am integrating it into other work that I'm doing.

Looks like this could be done via https://docs.docker.com/build/bake/reference/#targetannotations if that's preferred?

Yes, this is prefered as it goes into the image metadata for the repository rather than the image itself.

@xurizaemon
Copy link
Contributor Author

OK, I'll close this if you have existing WIP on it. Would be happy to look at a Bake approach of that's helpful, please say so if it is!

@xurizaemon xurizaemon closed this Feb 10, 2025
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.

3 participants