diff --git a/Makefile b/Makefile index 21457e7a..3d1f1977 100644 --- a/Makefile +++ b/Makefile @@ -14,16 +14,15 @@ DOCKER_REGISTRY ?= quay.io IMAGE_NAME ?= deckhand -IMAGE_PREFIX ?= attcomdev +IMAGE_PREFIX ?= airshipit IMAGE_TAG ?= latest HELM ?= helm 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 - -IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} +COMMIT ?= commit-id +IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} # Build Deckhand Docker image for this project .PHONY: images @@ -53,7 +52,11 @@ tests: .PHONY: build_deckhand build_deckhand: ifeq ($(USE_PROXY), true) - docker build --network host -t $(IMAGE) --label $(LABEL) -f images/deckhand/Dockerfile \ + docker build --network host -t $(IMAGE) \ + --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/deckhand/Dockerfile \ --build-arg http_proxy=$(PROXY) \ --build-arg https_proxy=$(PROXY) \ --build-arg HTTP_PROXY=$(PROXY) \ @@ -61,7 +64,11 @@ ifeq ($(USE_PROXY), true) --build-arg no_proxy=$(NO_PROXY) \ --build-arg NO_PROXY=$(NO_PROXY) . else - docker build --network host -t $(IMAGE) --label $(LABEL) -f images/deckhand/Dockerfile . + docker build --network host -t $(IMAGE) \ + --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/deckhand/Dockerfile . endif ifeq ($(PUSH_IMAGE), true) docker push $(IMAGE) diff --git a/images/deckhand/Dockerfile b/images/deckhand/Dockerfile index bd902b49..dcb5ec47 100644 --- a/images/deckhand/Dockerfile +++ b/images/deckhand/Dockerfile @@ -14,6 +14,13 @@ FROM ubuntu:16.04 +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-deckhand.readthedocs.org' +LABEL org.opencontainers.image.source='https://git.openstack.org/openstack/airship-deckhand' +LABEL org.opencontainers.image.vendor='The Airship Authors' +LABEL org.opencontainers.image.licenses='Apache-2.0' + ENV DEBIAN_FRONTEND noninteractive ENV container docker ENV PORT 9000 diff --git a/tools/gate/playbooks/docker-image-build.yaml b/tools/gate/playbooks/docker-image-build.yaml index 9cd82aa0..f4074dfd 100644 --- a/tools/gate/playbooks/docker-image-build.yaml +++ b/tools/gate/playbooks/docker-image-build.yaml @@ -83,6 +83,7 @@ DOCKER_REGISTRY: "quay.io" IMAGE_PREFIX: "airshipit" IMAGE_TAG: "{{ item }}" + COMMIT: "{{ zuul.newrev }}" PUSH_IMAGE: "true" with_items: "{{ image_tags.stdout_lines }}"