From a522a967890076aada61b5d0ce7988296a178a37 Mon Sep 17 00:00:00 2001 From: Andy Goldstein Date: Mon, 11 Jun 2018 14:48:47 -0400 Subject: [PATCH] Add TAG_LATEST support to Makefile Only tag an image as "latest" if TAG_LATEST is set to "true". Signed-off-by: Andy Goldstein --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3ec816ea3..b6a72730b 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,8 @@ ARCH ?= linux-amd64 VERSION ?= master +TAG_LATEST ?= false + ### ### These variables should not need tweaking. ### @@ -132,11 +134,11 @@ all-push: $(MAKE) push $(MAKE) push BIN=restic-init-container + push: .push-$(DOTFILE_IMAGE) push-name .push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE) @docker push $(IMAGE):$(VERSION) - @if git describe --tags --exact-match >/dev/null 2>&1; \ - then \ + @if [[ "$(TAG_LATEST)" == "true" ]]; then \ docker tag $(IMAGE):$(VERSION) $(IMAGE):latest; \ docker push $(IMAGE):latest; \ fi