Skip to content

chore(image): label the image so ghcr shows a description - #29

Merged
tschm merged 1 commit into
mainfrom
chore/oci-image-labels
Aug 31, 2026
Merged

chore(image): label the image so ghcr shows a description#29
tschm merged 1 commit into
mainfrom
chore/oci-image-labels

Conversation

@tschm

@tschm tschm commented Aug 31, 2026

Copy link
Copy Markdown
Member

The ghcr.io package page was showing its own hint:

To provide a description, add the following line to your Dockerfile:
LABEL org.opencontainers.image.description DESCRIPTION

It was right — the Dockerfile carried no OCI labels at all.

What changed

Dockerfile — the five standard OCI labels: title, description, source, url, licenses. The description text is the repo's own GitHub description; licenses is MIT, matching LICENSE.

.github/workflows/image.yml — the label alone would not have fixed the page. The image is built for linux/amd64,linux/arm64, and ghcr reads a multi-arch package's description off the manifest index, not off the per-platform image configs where --label lands. So: DOCKER_METADATA_ANNOTATIONS_LEVELS: index,manifest on the metadata-action step, and annotations: passed to build-push-action alongside labels:.

Worth noting metadata-action was already emitting a description label from the repo metadata, and --label wins over the Dockerfile. The labels in the file are what make a plain local docker build produce a labelled image too — both paths now carry the same text.

Verification

Local docker build, then docker image inspect --format '{{json .Config.Labels}}':

{
    "org.opencontainers.image.description": "Grafana + Prometheus board for a repo fleet: template drift, CI on the default branch, open pull requests, and your local working copies.",
    "org.opencontainers.image.licenses": "MIT",
    "org.opencontainers.image.source": "https://github.com/Jebel-Quant/monitoring",
    "org.opencontainers.image.title": "Fleet monitoring",
    "org.opencontainers.image.url": "https://jebel-quant.github.io/monitoring/"
}

The index annotations can only be confirmed after this merges and the Image workflow republishes — the package page should then carry the description instead of the hint.

🤖 Generated with Claude Code

The package page on ghcr.io showed its "add LABEL
org.opencontainers.image.description" hint, because the Dockerfile carried
no OCI labels at all. Add the five standard ones, taking the description
from the repo's own and the license from LICENSE.

The label alone is not enough here. The image is built for two platforms,
and ghcr reads a multi-arch package's description off the manifest index,
not off the per-platform image configs where --label lands - so the page
would have stayed blank. Ask metadata-action for index-level annotations
and hand them to build-push-action alongside the labels.

metadata-action already emitted a description label from the repo
metadata, and --label wins over the Dockerfile; the labels in the file are
what make a plain `docker build` produce a labelled image too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tschm
tschm merged commit b802c1f into main Aug 31, 2026
4 checks passed
@tschm
tschm deleted the chore/oci-image-labels branch August 31, 2026 07:04
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.

1 participant