-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
82 lines (67 loc) · 2.4 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
SHELL=/bin/sh
## Colors
ifndef VERBOSE
.SILENT:
endif
PHP_VERSIONS := 7.2 7.3 7.4
PHP_VERSION ?= $(lastword $(sort $(PHP_VERSIONS)))
COLOR_COMMENT=\033[0;32m
IMAGE_PATH=/benjy80/php-fpm-opencv
REGISTRY_DOMAIN=docker.io
VERSION=4.1.1
IMAGE=${REGISTRY_DOMAIN}${IMAGE_PATH}:${VERSION}
## Help
help:
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n"
printf " make [target]\n\n"
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n"
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
## build and push image
all: build push_image
## build image and tags it
build:
@for php_version in $(PHP_VERSIONS); do \
docker build --target fpm-prod -f php-fpm/$$php_version/Dockerfile ./php-fpm/$$php_version -t ${REGISTRY_DOMAIN}${IMAGE_PATH}-$$php_version:${VERSION}; \
done
docker build -f httpd/Dockerfile ./httpd -t ${REGISTRY_DOMAIN}${IMAGE_PATH}-httpd
## login on registry
registry_login:
docker login ${REGISTRY_DOMAIN}
## push image
push_image: registry_login
for php_version in $(PHP_VERSIONS); do \
docker push ${REGISTRY_DOMAIN}${IMAGE_PATH}-$$php_version:${VERSION}; \
done
docker push ${REGISTRY_DOMAIN}${IMAGE_PATH}-httpd
## build image and tags it
build_http:
docker build -f httpd/Dockerfile ./httpd -t ${REGISTRY_DOMAIN}${IMAGE_PATH}-httpd
## push image
push_http_image: registry_login
docker push ${REGISTRY_DOMAIN}${IMAGE_PATH}-httpd
## build image and tags it
build_72:
docker build --target fpm-prod -f php-fpm/7.2/Dockerfile ./php-fpm/7.2 -t ${REGISTRY_DOMAIN}${IMAGE_PATH}-7.2:${VERSION}; \
## push image
push_72_image: registry_login
docker push ${REGISTRY_DOMAIN}${IMAGE_PATH}-7.2:${VERSION}
## build image and tags it
build_73:
docker build --target fpm-prod -f php-fpm/7.3/Dockerfile ./php-fpm/7.3 -t ${REGISTRY_DOMAIN}${IMAGE_PATH}-7.3:${VERSION}; \
## push image
push_73_image: registry_login
docker push ${REGISTRY_DOMAIN}${IMAGE_PATH}-7.3:${VERSION}
## build image and tags it
build_74:
docker build --target fpm-prod -f php-fpm/7.4/Dockerfile ./php-fpm/7.4 -t ${REGISTRY_DOMAIN}${IMAGE_PATH}-7.4:${VERSION}; \
## push image
push_74_image: registry_login
docker push ${REGISTRY_DOMAIN}${IMAGE_PATH}-7.4:${VERSION}