bazelbuild / rules_docker

Rules for building and handling Docker images with Bazel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support image labels/annotations

pauldraper opened this issue Β· comments

πŸš€ 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.

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