build(docker): bake image source label for GHCR repo linking#46
Merged
Conversation
The canonical, build-tool-independent way GHCR links a container package to its repo is a Dockerfile LABEL baked into the image config — not buildx/metadata-action annotations. Add it so freshly-created packages auto-connect. Note: GHCR evaluates the source at package CREATION, so this links new packages; an already-orphaned package needs a one-time manual connect (or delete + re-publish) regardless. Type build → no version bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The published web image isn't linked to the repo. The canonical, documented mechanism for container packages is a
LABEL org.opencontainers.image.sourcebaked into the image config — not the buildx/metadata-action annotations we'd been tuning.Change
One line in the Dockerfile's runtime stage:
Verified locally:
docker inspectconfirms the label is in the final image config.Important: this links new packages, not the existing orphan
GHCR evaluates the source at package creation, not on every push. So:
openconcho-webpackage (already orphaned): needs a one-time fix — either the manual Package settings → Connect repository UI step, or delete the package + re-publish (fresh creation auto-connects with this label). There's no REST endpoint to connect, so it can't be automated.Type
build→ no version bump.