forked from invoiceninja/dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (50 loc) · 1.77 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ifndef TAG
$(error The TAG variable is missing.)
endif
# Docker Hub namespace
HUB_NAMESPACE="invoiceninja"
# Image name
IMAGE="invoiceninja"
# Check if v5 tag is passed, so that a v5 version should be built
IS_V5=$(shell echo ${TAG} | egrep ^5)
# Version of Invoice Ninja. As the tag can be something like 5.0.4-p1, the version is 5.0.4.
# This supports changes to the Dockerfiles with always the same Invoice Ninja version
VERSION=$(shell echo ${TAG} | sed "s/-.*//")
# Building docker images based on alpine.
# Assigned tags:
# - :4
# - :<RELEASE VERSION>
.PHONY: build-alpine
build-alpine:
ifeq ($(IS_V5),)
$(info Make: Building "$(VERSION)" tagged images from alpine.)
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} ./alpine/4/
# Tag as 4
@docker tag ${HUB_NAMESPACE}/${IMAGE}:alpine-${VERSION} ${HUB_NAMESPACE}/${IMAGE}:4
$(info Make: Done.)
endif
.PHONY: push-alpine
push-alpine:
ifeq ($(IS_V5),)
$(info Make: Pushing tagged images from alpine.)
@docker push ${HUB_NAMESPACE}/${IMAGE}:${VERSION}
@docker push ${HUB_NAMESPACE}/${IMAGE}:4
$(info Make: Done.)
endif
.PHONY: build-alpine-v5
build-alpine-v5:
ifneq ($(IS_V5),)
$(info Make: Building "$(VERSION)" tagged images from alpine.)
@docker build -t ${HUB_NAMESPACE}/${IMAGE}:${VERSION} --build-arg INVOICENINJA_VERSION=${VERSION} ./alpine/5/
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:5
@docker tag ${HUB_NAMESPACE}/${IMAGE}:${VERSION} ${HUB_NAMESPACE}/${IMAGE}:latest
$(info Make: Done.)
endif
.PHONY: push-alpine-v5
push-alpine-v5:
ifneq ($(IS_V5),)
$(info Make: Pushing tagged images from alpine.)
@docker push ${HUB_NAMESPACE}/${IMAGE}:${VERSION}
@docker push ${HUB_NAMESPACE}/${IMAGE}:5
@docker push ${HUB_NAMESPACE}/${IMAGE}:latest
endif