diff --git a/Makefile b/Makefile index 74d3b9c..0a904c8 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,16 @@ SHELL = /bin/sh +BRANCH = $(shell git branch --show-current) + +ifeq ($(BRANCH),main) + IMAGE_TAG = stable +else ($(BRANCH),develop) + IMAGE_TAG = latest +else + IMAGE_TAG = $(BRANCH) +endif + define PRINT_HELP_PYSCRIPT import re, sys @@ -19,30 +29,30 @@ help: ## Displays this message. @python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) build: ## Builds the Docker images - docker build -t ${USER}/vm370:latest-amd64 --platform=linux/amd64 . - docker build -t ${USER}/vm370:latest-arm64 --platform=linux/arm64 . - docker build -t ${USER}/vm370:latest-armv6 --platform=linux/arm/v6 . - docker build -t ${USER}/vm370:latest-armv7 --platform=linux/arm/v7 . - docker build -t ${USER}/vm370:latest-s390x --platform=linux/s390x . - docker build -t ${USER}/vm370:latest-ppc64le --platform=linux/ppc64le . + docker build -t ${USER}/vm370:${IMAGE_TAG}-amd64 --platform=linux/amd64 . + docker build -t ${USER}/vm370:${IMAGE_TAG}-arm64 --platform=linux/arm64 . + docker build -t ${USER}/vm370:${IMAGE_TAG}-armv6 --platform=linux/arm/v6 . + docker build -t ${USER}/vm370:${IMAGE_TAG}-armv7 --platform=linux/arm/v7 . + docker build -t ${USER}/vm370:${IMAGE_TAG}-s390x --platform=linux/s390x . + docker build -t ${USER}/vm370:${IMAGE_TAG}-ppc64le --platform=linux/ppc64le . start: build ## Builds and starts the local arch Docker image docker start -d -p 3270:3270 vm370 upload_images: ## Uploads the docker images - docker image push ${USER}/vm370:latest-amd64 - docker image push ${USER}/vm370:latest-arm64 - docker image push ${USER}/vm370:latest-armv6 - docker image push ${USER}/vm370:latest-armv7 - docker image push ${USER}/vm370:latest-s390x - docker image push ${USER}/vm370:latest-ppc64le + docker image push ${USER}/vm370:${IMAGE_TAG}-amd64 + docker image push ${USER}/vm370:${IMAGE_TAG}-arm64 + docker image push ${USER}/vm370:${IMAGE_TAG}-armv6 + docker image push ${USER}/vm370:${IMAGE_TAG}-armv7 + docker image push ${USER}/vm370:${IMAGE_TAG}-s390x + docker image push ${USER}/vm370:${IMAGE_TAG}-ppc64le upload: upload_images ## Uploads the manifest - docker manifest create ${USER}/vm370:latest \ - --amend ${USER}/vm370:latest-amd64 \ - --amend ${USER}/vm370:latest-amd64 \ - --amend ${USER}/vm370:latest-armv6 \ - --amend ${USER}/vm370:latest-armv7 \ - --amend ${USER}/vm370:latest-s390x \ - --amend ${USER}/vm370:latest-ppc64le - docker manifest push ${USER}/vm370:latest + docker manifest create ${USER}/vm370:${IMAGE_TAG} \ + --amend ${USER}/vm370:${IMAGE_TAG}-amd64 \ + --amend ${USER}/vm370:${IMAGE_TAG}-amd64 \ + --amend ${USER}/vm370:${IMAGE_TAG}-armv6 \ + --amend ${USER}/vm370:${IMAGE_TAG}-armv7 \ + --amend ${USER}/vm370:${IMAGE_TAG}-s390x \ + --amend ${USER}/vm370:${IMAGE_TAG}-ppc64le + docker manifest push ${USER}/vm370:${IMAGE_TAG}