diff --git a/Makefile b/Makefile index b51bdc0b..8a9b7091 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ PROXY ?= http://proxy.foo.com:8000 NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local USE_PROXY ?= false PUSH_IMAGE ?= false -LABEL ?= commit-id +COMMIT ?= commit-id IMAGE ?= $(DOCKER_REGISTRY)/$(IMAGE_PREFIX)/$(IMAGE_NAME):$(IMAGE_TAG) PYTHON_BASE_IMAGE ?= python:3.6 export @@ -63,7 +63,11 @@ format: py_format .PHONY: build_pegleg build_pegleg: ifeq ($(USE_PROXY), true) - docker build -t $(IMAGE) --network=host --label $(LABEL) -f images/pegleg/Dockerfile \ + docker build -t $(IMAGE) --network=host \ + --label "org.opencontainers.image.revision=$(COMMIT)" \ + --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ + --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ + -f images/pegleg/Dockerfile \ --build-arg FROM=$(PYTHON_BASE_IMAGE) \ --build-arg http_proxy=$(PROXY) \ --build-arg https_proxy=$(PROXY) \ @@ -73,7 +77,11 @@ ifeq ($(USE_PROXY), true) --build-arg NO_PROXY=$(NO_PROXY) \ --build-arg ctx_base=$(PEGLEG_BUILD_CTX) . else - docker build -t $(IMAGE) --network=host --label $(LABEL) -f images/pegleg/Dockerfile \ + docker build -t $(IMAGE) --network=host \ + --label "org.opencontainers.image.revision=$(COMMIT)" \ + --label "org.opencontainers.image.created=$(shell date --rfc-3339=seconds --utc)" \ + --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ + -f images/pegleg/Dockerfile \ --build-arg FROM=$(PYTHON_BASE_IMAGE) \ --build-arg ctx_base=$(PEGLEG_BUILD_CTX) . endif diff --git a/images/pegleg/Dockerfile b/images/pegleg/Dockerfile index 66966b23..62c4dc09 100644 --- a/images/pegleg/Dockerfile +++ b/images/pegleg/Dockerfile @@ -1,6 +1,13 @@ ARG FROM=python:3.6 FROM ${FROM} +LABEL org.opencontainers.image.authors='airship-discuss@lists.airshipit.org, irc://#airshipit@freenode' +LABEL org.opencontainers.image.url='https://airshipit.org' +LABEL org.opencontainers.image.documentation='https://airship-pegleg.readthedocs.org' +LABEL org.opencontainers.image.source='https://git.openstack.org/openstack/airship-pegleg' +LABEL org.opencontainers.image.vendor='The Airship Authors' +LABEL org.opencontainers.image.licenses='Apache-2.0' + VOLUME /var/pegleg WORKDIR /var/pegleg diff --git a/tools/gate/playbooks/docker-image-build.yaml b/tools/gate/playbooks/docker-image-build.yaml index 23f636cf..0fe524e8 100644 --- a/tools/gate/playbooks/docker-image-build.yaml +++ b/tools/gate/playbooks/docker-image-build.yaml @@ -116,6 +116,7 @@ DOCKER_REGISTRY: "quay.io" IMAGE_PREFIX: "airshipit" IMAGE_TAG: "{{ item }}" + COMMIT: "{{ zuul.newrev }}" PUSH_IMAGE: "true" with_items: "{{ image_tags.stdout_lines }}"