Fix: git commit id labels on images
1) Use OCI Image Specs for labels instead of custom 'commit-id=xxxxx' or legacy "Label Schema" 2) Fix missing git commit id labels on images (.revision) 3) Add human-readable title (.title) of the image, URL (.url), and a few other properties (annotations) according to the latest Specs Change-Id: Iebb37edd003204d3adc41aa9af76612ab419993a
This commit is contained in:
parent
85896437af
commit
48f79aee44
17
Makefile
17
Makefile
@ -14,15 +14,14 @@
|
|||||||
|
|
||||||
DOCKER_REGISTRY ?= quay.io
|
DOCKER_REGISTRY ?= quay.io
|
||||||
IMAGE_NAME ?= deckhand
|
IMAGE_NAME ?= deckhand
|
||||||
IMAGE_PREFIX ?= attcomdev
|
IMAGE_PREFIX ?= airshipit
|
||||||
IMAGE_TAG ?= latest
|
IMAGE_TAG ?= latest
|
||||||
HELM ?= helm
|
HELM ?= helm
|
||||||
PROXY ?= http://proxy.foo.com:8000
|
PROXY ?= http://proxy.foo.com:8000
|
||||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||||
USE_PROXY ?= false
|
USE_PROXY ?= false
|
||||||
PUSH_IMAGE ?= false
|
PUSH_IMAGE ?= false
|
||||||
LABEL ?= commit-id
|
COMMIT ?= commit-id
|
||||||
|
|
||||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||||
|
|
||||||
# Build Deckhand Docker image for this project
|
# Build Deckhand Docker image for this project
|
||||||
@ -53,7 +52,11 @@ tests:
|
|||||||
.PHONY: build_deckhand
|
.PHONY: build_deckhand
|
||||||
build_deckhand:
|
build_deckhand:
|
||||||
ifeq ($(USE_PROXY), true)
|
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 http_proxy=$(PROXY) \
|
||||||
--build-arg https_proxy=$(PROXY) \
|
--build-arg https_proxy=$(PROXY) \
|
||||||
--build-arg HTTP_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) \
|
||||||
--build-arg NO_PROXY=$(NO_PROXY) .
|
--build-arg NO_PROXY=$(NO_PROXY) .
|
||||||
else
|
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
|
endif
|
||||||
ifeq ($(PUSH_IMAGE), true)
|
ifeq ($(PUSH_IMAGE), true)
|
||||||
docker push $(IMAGE)
|
docker push $(IMAGE)
|
||||||
|
@ -14,6 +14,13 @@
|
|||||||
|
|
||||||
FROM ubuntu:16.04
|
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 DEBIAN_FRONTEND noninteractive
|
||||||
ENV container docker
|
ENV container docker
|
||||||
ENV PORT 9000
|
ENV PORT 9000
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
DOCKER_REGISTRY: "quay.io"
|
DOCKER_REGISTRY: "quay.io"
|
||||||
IMAGE_PREFIX: "airshipit"
|
IMAGE_PREFIX: "airshipit"
|
||||||
IMAGE_TAG: "{{ item }}"
|
IMAGE_TAG: "{{ item }}"
|
||||||
|
COMMIT: "{{ zuul.newrev }}"
|
||||||
PUSH_IMAGE: "true"
|
PUSH_IMAGE: "true"
|
||||||
with_items: "{{ image_tags.stdout_lines }}"
|
with_items: "{{ image_tags.stdout_lines }}"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user