Description
I'd like to use chartpress together with the docker/metadata-action that provides standardized image labels and values - to set a few labels on built images. When using ghcr.io
, you often want to couple a built image with a GitHub repository, and the OCI standardized labels can help do that.
The docker/metadata-action can emit the following labels for example.
"org.opencontainers.image.title": "Hello-World",
"org.opencontainers.image.description": "This your first repo!",
"org.opencontainers.image.url": "https://github.com/octocat/Hello-World",
"org.opencontainers.image.source": "https://github.com/octocat/Hello-World",
"org.opencontainers.image.version": "1.2.3",
"org.opencontainers.image.created": "2020-01-10T00:30:00.000Z",
"org.opencontainers.image.revision": "90dd6032fac8bda1b6c4436a2e65de27961ed071",
"org.opencontainers.image.licenses": "MIT"
#142 would add support for declaring extraBuildCommandOptions
in chartpress.yaml
to set labels via --labels
flag, but updating chartpress.yaml
dynamically wouldn't be a good idea as that is a hint for chartpress to rebuild all images etc as well. So, either there is something fixed in chartpress.yaml
that makes use of the expanded variables like...
expansion_namespace = {
"LAST_COMMIT": _get_latest_commit_tagged_or_modifying_paths(
*all_image_paths, echo=False
),
"TAG": image_tag,
}
Brainstorming
chartpress
to automatically pass--labels
?- Updating Dockerfile with
--build-args
to set labels? - Updating
chartpress.yaml
with Allow extra options to be passed to docker build #142 and namespace expansion ofLAST_COMMIT
etc to set for exampleorg.opencontainers.image.revision
andorg.opencontainers.image.version
to referenceTAG
?
I'm leaning towards the idea of bypassing use of docker/metadata-action and relying entirely on namespace expansion and the new #142 feature, where we could perhaps also add a date expansion to support setting org.opencontainers.image.created
.