Support image labels/annotations
pauldraper opened this issue Β· comments
Paul Draper commented
π feature request
Relevant Rules
container_iamge
Description
Add labels to the Docker image. Labels are used for all sorts of things.
One example: Datadog will automatically link to sources based on the opencontainers annotations:
org.opencontainers.image.revision=$(git rev-parse HEAD)
org.opencontainers.image.source=github.com/example-org/example-repo
Describe the solution you'd like
I would like to specify a dict of Docker image labels.
container_image(
labels = {
"org.opencontainers.image.revision": "{GIT_COMMIT}",
"org.opencontainers.image.source": "github.com/example-org/example-repo",
}
)
Describe alternatives you've considered
There aren't really any good ones.
Paul Draper commented
This is already done, just not documented.
Read source code for labels
, label_files
, and label_file_strings
.
https://github.com/bazelbuild/rules_docker/blob/master/container/image.bzl