Docker-development/code-formatter/Makefile
2021-03-06 09:10:18 +01:00

38 lines
1.4 KiB
Makefile

#
# Settings
#
# Name of the docker image
APP_NAME := code-formatter
# Select the docker registry to use for the image
DOCKER_REGISTRY := yoursystemcz
# Describe current branch
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
COMMIT = $(shell git rev-parse HEAD)
GIT_TAG = $(shell git describe --tags --exact-match 2>/dev/null)
VERSION := $(or $(GIT_TAG),latest)
all : VERSION := 1.1.2
all : build release
.PHONY : all
build :
docker build --build-arg VERSION=$(VERSION) --build-arg PHP_VERSION="php7.3" --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.3 .
docker build --build-arg VERSION=$(VERSION) --build-arg PHP_VERSION="php7.4" --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4 .
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT_SHA=$(COMMIT) -t $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php5.6 .
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4 $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)
docker tag $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4 $(DOCKER_REGISTRY)/$(APP_NAME):latest
release : build
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.3
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php7.4
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)-php5.6
docker push $(DOCKER_REGISTRY)/$(APP_NAME):$(VERSION)
docker push $(DOCKER_REGISTRY)/$(APP_NAME):latest