-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
37 lines (33 loc) · 1.12 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
BUILD_NAME=php
COMPOSE_BUILD_NAME=php-container
VERSIONS=7.4 7.3 7.2 7.1
LATEST=$(firstword $(VERSIONS))
ALL=$(addprefix php,$(VERSIONS))
VCS_REF="$(shell git rev-parse HEAD)"
BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%m:%SZ")"
DOCKERHUB_USER=groovytron
.PHONY: all
all: $(ALL)
.PHONY: $(ALL)
$(ALL):
BUILD_DATE=$(BUILD_DATE) \
BUILD_NAME=$(BUILD_NAME) \
COMPOSE_BUILD_NAME=$(COMPOSE_BUILD_NAME) \
VCS_REF=$(VCS_REF) \
docker-compose -f build.yml build \
$@
.PHONY:clean
clean:
for VERSION in $(VERSIONS); do \
docker image rm -f $(COMPOSE_BUILD_NAME):$$VERSION; \
done
.PHONY:publish-docker-images
publish-docker-images:
for VERSION in $(VERSIONS); do \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(DOCKERHUB_USER)/$(BUILD_NAME):$$VERSION-$(VCS_REF) && \
docker push $(DOCKERHUB_USER)/$(BUILD_NAME):$$VERSION-$(VCS_REF) && \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(DOCKERHUB_USER)/$(BUILD_NAME):$$VERSION && \
docker push $(DOCKERHUB_USER)/$(BUILD_NAME):$$VERSION; \
done && \
docker tag $(COMPOSE_BUILD_NAME):$(LATEST) $(DOCKERHUB_USER)/$(BUILD_NAME):latest && \
docker push $(DOCKERHUB_USER)/$(BUILD_NAME):latest