Skip to content

Commit

Permalink
Tag docker image according to branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rbanffy committed Jul 31, 2023
1 parent 7c711c2 commit 6485195
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}

0 comments on commit 6485195

Please sign in to comment.