Open pat-s opened 1 week ago
I'm not a fan to set any label automatically. But there is https://github.com/thegeeklab/wp-docker-buildx/blob/main/docker/docker.go#L105 already. You can just use consume it in your containerfile:
LABEL org.opencontainers.image.created=$DOCKER_IMAGE_CREATED
Ah, thanks!
The following works:
ARG DOCKER_IMAGE_CREATED
LABEL org.opencontainers.image.created="${DOCKER_IMAGE_CREATED}"
Do you still think there should at least an option to auto-set the openconainer labels?
I think so yes, but I understand your reasoning not wanting to set any label by default.
One could even argue that the added value of a plugin is to simplify things like that for users but I am also OK with the workaround 🙂️
Alright you convinced me. Lets add them but disabled by default by a settings flag?
That would be great! And yes, if there's a flag and a choice for the user, it should likely be disabled by default.
In the official buildx plugin some labels are automatically set by the plugin by inferring information from the build context.
One of these,
org.opencontainers.image.created
is also somewhat important as e.g. artifacthub.io requires it for some metadata extraction.For now I can workaround this via
date -u +"%Y-%m-%dT%H:%M:%SZ")
explicitly but it would be great to have support for this within the plugin.