From 9573b179cbd159182453d2ff10703c40e45c25d8 Mon Sep 17 00:00:00 2001 From: Stacey Fletcher Date: Sat, 17 Feb 2018 16:14:59 -0600 Subject: [PATCH] Add labels to Makefile image build This ps allows labels to be added to the docker image at build time Change-Id: I17c816077bc5a3ad389cbe38ceaaf42f21690c09 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 18f08e4..e85589e 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ IMAGE_TAG ?= latest HELM ?= helm PROXY ?= http://one.proxy.att.com:8080 USE_PROXY ?= false - +LABEL ?= commit-id IMAGE_LIST := maas-rack-controller maas-region-controller sstream-cache .PHONY: images @@ -56,9 +56,9 @@ dry-run: helm_lint .PHONY: build build: ifeq ($(USE_PROXY), true) - docker build -t $(IMAGE_PREFIX)/$(IMAGE_SUFFIX):$(IMAGE_TAG) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR) --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) + docker build -t $(IMAGE_PREFIX)/$(IMAGE_SUFFIX):$(IMAGE_TAG) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR) --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) else - docker build -t $(IMAGE_PREFIX)/$(IMAGE_SUFFIX):$(IMAGE_TAG) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR) + docker build -t $(IMAGE_PREFIX)/$(IMAGE_SUFFIX):$(IMAGE_TAG) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR) endif .PHONY: clean