weaveworks / build-tools

Collection of build & test tools shared by various Weaveworks projects
Other
44 stars 20 forks source link

Enforce Dockerfile labels with lint #102

Open jml opened 7 years ago

jml commented 7 years ago

We often have the problem that we don't know where the source code for an image lives.

There's a more-or-less standard way of providing this information, using Docker labels. We should do that.

e.g. https://github.com/weaveworks/weave/blob/master/prog/weaver/Dockerfile.template#L7-L13

LABEL maintainer "Weaveworks Inc <help@weave.works>"
LABEL \
      org.label-schema.name="Weave Net" \
      org.label-schema.description="Weave Net creates a virtual network that connects Docker containers across multiple hosts and enables their automatic discovery" \
      org.label-schema.url="https://weave.works" \
      org.label-schema.vcs-url="https://github.com/weaveworks/weave" \
      org.label-schema.vendor="Weaveworks"
tomwilkie commented 7 years ago

We often have the problem that we don't know where the source code for an image lives.

"Often"? For example?

There's a more-or-less standard way of providing this information, using Docker labels. We should do that.

I wouldn't consider the label-schema.org stuff to be widely accepted or a standard. I'd describe it as something that was started started, that didn't get wide adoption, and that people have now moved on from. For instance, there are only 11 threads on its email list[1], these tags aren't "supported" in anyway by the docker hub, and there are only 1.2k images using them[2].

[1] https://groups.google.com/forum/#!forum/label-schema [2] https://microbadger.com/labelschema

I much prefer the naming convention approach to solving this problem.

jml commented 7 years ago

Examples:

A naming convention could work, but the issue is that we have several:

At the very least.

bricef commented 6 years ago

Suggested minimum useful set of labels:

LABEL works.weave.source-path="/grafana/Dockerfile" \
      org.label-schema.schema-version="1.0" \
      org.label-schema.vcs-url="https://github.com/weaveworks/service-conf"

Where works.weave.source-path is the path to the Dockerfile for this image.

bricef commented 6 years ago

@marccarre has been working on https://github.com/weaveworks-experiments/imagediff to help with this process.