Skip to content

Commit c7bcf1c

Browse files
committed
Add org.opencontainers.image.* labels to Dockerfiles
- This should ultimately help for image-to-code back references. - `org.label-schema.*` labels are now deprecated, in favour of `org.opencontainers.image.*` labels. See also: https://github.com/opencontainers/image-spec/blob/master/annotations.md#back-compatibility-with-label-schema - `MAINTAINER` is deprecated, in favour of the `maintainer` label. - Git revision (`git rev-parse HEAD`) is now injected at `docker build` time.
1 parent b2dfd99 commit c7bcf1c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
# All this must go at top of file I'm afraid.
66
IMAGE_PREFIX := quay.io/weaveworks
77
IMAGE_TAG := $(shell ./tools/image-tag)
8+
GIT_REVISION := $(shell git rev-parse HEAD)
89
UPTODATE := .uptodate
910

1011
# Building Docker images is now automated. The convention is every directory
1112
# with a Dockerfile in it builds an image calls quay.io/weaveworks/<dirname>.
1213
# Dependencies (i.e. things that go in the image) still need to be explicitly
1314
# declared.
1415
%/$(UPTODATE): %/Dockerfile
15-
$(SUDO) docker build -t $(IMAGE_PREFIX)/$(shell basename $(@D)) $(@D)/
16+
$(SUDO) docker build --build-arg=revision=$(GIT_REVISION) -t $(IMAGE_PREFIX)/$(shell basename $(@D)) $(@D)/
1617
$(SUDO) docker tag $(IMAGE_PREFIX)/$(shell basename $(@D)) $(IMAGE_PREFIX)/$(shell basename $(@D)):$(IMAGE_TAG)
1718
touch $@
1819

gfdatasource/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
FROM alpine:3.6
2-
LABEL works.weave.role=system
32
RUN apk add --no-cache --upgrade python3
43
RUN python3 -m ensurepip && pip3 install --upgrade pip
54
COPY requirements.txt /
65
RUN pip3 install -r requirements.txt
76
COPY gfdatasource /
87
ENTRYPOINT ["/gfdatasource"]
8+
9+
ARG revision
10+
LABEL works.weave.role="system" \
11+
maintainer="Weaveworks <[email protected]>" \
12+
org.opencontainers.image.title="grafanalib" \
13+
org.opencontainers.image.source="https://github.com/weaveworks/grafanalib" \
14+
org.opencontainers.image.revision="${revision}" \
15+
org.opencontainers.image.vendor="Weaveworks"

0 commit comments

Comments
 (0)