From 161fa0e3481e652a62f0cbf252d8759d6ec71101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20DECOOL?= Date: Fri, 6 May 2022 22:49:31 +0200 Subject: [PATCH] Set a tag strategy --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f582b69..2d3626c 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,22 @@ +TAG := $(GITHUB_REF) +ifeq ($(TAG),) + TAG := $(shell git symbolic-ref --short -q HEAD) +endif +ifeq ($(TAG),) + TAG := $(shell git rev-parse --short --verify HEAD) +endif + define docker_build_and_push docker buildx build \ --push \ --platform linux/arm64,linux/amd64 \ - -t "schickling/$1:$(if $2,$2,latest)" \ + -t "schickling/$1:$(if $2,$2,$(TAG))" \ ./$1 endef help: @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n\nTargets:\n"} /^[0-9a-zA-Z_-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST) + @echo $(TAG) all: beanstalkd beanstalkd-console hugin jekyll latex mailcatcher mysql-backup-s3 nginx-envtpl nodejs octave opencv postgres-backup-s3 postgres-restore-s3 redis-commander rust s3cmd scala-sbt-docker swagger-ui thumbor-nginx-cors ## Build all images