-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
292 lines (242 loc) · 8.21 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#!/usr/bin/env make
#
# An Anax module.
# See organisation on GitHub: https://github.com/canax
# ------------------------------------------------------------------------
#
# General stuff, reusable for all Makefiles.
#
# Detect OS
OS = $(shell uname -s)
# Defaults
ECHO = echo
# Make adjustments based on OS
ifneq (, $(findstring CYGWIN, $(OS)))
ECHO = /bin/echo -e
endif
# Colors and helptext
NO_COLOR = \033[0m
ACTION = \033[32;01m
OK_COLOR = \033[32;01m
ERROR_COLOR = \033[31;01m
WARN_COLOR = \033[33;01m
# Which makefile am I in?
WHERE-AM-I = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_MAKEFILE := $(call WHERE-AM-I)
# Echo some nice helptext based on the target comment
HELPTEXT = $(ECHO) "$(ACTION)--->" `egrep "^\# target: $(1) " $(THIS_MAKEFILE) | sed "s/\# target: $(1)[ ]*-[ ]* / /g"` "$(NO_COLOR)"
# Check version and path to command and display on one line
CHECK_VERSION = printf "%-15s %-10s %s\n" "`basename $(1)`" "`$(1) --version $(2)`" "`which $(1)`"
# Print out colored action message
ACTION_MESSAGE = $(ECHO) "$(ACTION)---> $(1)$(NO_COLOR)"
# target: help - Displays help.
.PHONY: help
help:
@$(call HELPTEXT,$@)
@sed '/^$$/q' $(THIS_MAKEFILE) | tail +3 | sed 's/#\s*//g'
@$(ECHO) "Usage:"
@$(ECHO) " make [target] ..."
@$(ECHO) "target:"
@egrep "^# target:" $(THIS_MAKEFILE) | sed 's/# target: / /g'
# ------------------------------------------------------------------------
#
# Specifics for this project.
#
D := docker
DC := docker-compose
# target: update - Create the Dockerfiles from source.
.PHONY: update
update:
@$(call HELPTEXT,$@)
./update.bash
# target: build - Build the docker images.
.PHONY: build
build: update build-php-cli build-php-apache build-remserver
@$(call HELPTEXT,$@)
#--no-cache
# target: build-php82 - Build images php-82 (option="--no-cache").
.PHONY: build-php82
build-php82: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php82/cli/Dockerfile \
--tag anax/dev:php82 \
--tag anax/dev:php82-cli \
php82/cli
$(D) build $(options) --file php82/apache/Dockerfile \
--tag anax/dev:php82-apache \
php82/apache
# target: build-php81 - Build images php-81 (option="--no-cache").
.PHONY: build-php81
build-php81: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php81/cli/Dockerfile \
--tag anax/dev:php81 \
--tag anax/dev:php81-cli \
php81/cli
$(D) build $(options) --file php81/apache/Dockerfile \
--tag anax/dev:php81-apache \
php81/apache
# target: build-php80 - Build images php-80 (option="--no-cache").
.PHONY: build-php80
build-php80: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php80/cli/Dockerfile \
--tag anax/dev:php80 \
--tag anax/dev:php80-cli \
php80/cli
$(D) build $(options) --file php80/apache/Dockerfile \
--tag anax/dev:php80-apache \
php80/apache
# target: build-php74 - Build images php-74 (option="--no-cache").
.PHONY: build-php74
build-php74: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php74/cli/Dockerfile \
--tag anax/dev:php74 \
--tag anax/dev:php74-cli \
php74/cli
$(D) build $(options) --file php74/apache/Dockerfile \
--tag anax/dev:php74-apache \
php74/apache
# target: build-php56 - Build images php-56 (option="--no-cache").
.PHONY: build-php56
build-php56: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php56/cli/Dockerfile \
--tag anax/dev:php56 \
--tag anax/dev:php56-cli \
php56/cli
$(D) build $(options) --file php56/apache/Dockerfile \
--tag anax/dev:php56-apache \
php56/apache
# target: build-php-cli - Build images php-cli (option="--no-cache").
.PHONY: build-php-cli
build-php-cli: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php82/cli/Dockerfile \
--tag anax/dev:php82 \
--tag anax/dev:php82-cli \
php82/cli
$(D) build $(options) --file php81/cli/Dockerfile \
--tag anax/dev:latest \
--tag anax/dev:cli \
--tag anax/dev:latest-cli \
--tag anax/dev:php81 \
--tag anax/dev:php81-cli \
php81/cli
$(D) build $(options) --file php80/cli/Dockerfile \
--tag anax/dev:php80 \
--tag anax/dev:php80-cli \
php80/cli
$(D) build $(options) --file php74/cli/Dockerfile \
--tag anax/dev:php74 \
--tag anax/dev:php74-cli \
php74/cli
$(D) build $(options) --file php73/cli/Dockerfile \
--tag anax/dev:php73 \
--tag anax/dev:php73-cli \
php73/cli
$(D) build $(options) --file php72/cli/Dockerfile \
--tag anax/dev:php72 \
--tag anax/dev:php72-cli \
php72/cli
$(D) build $(options) --file php71/cli/Dockerfile \
--tag anax/dev:php71 \
--tag anax/dev:php71-cli \
php71/cli
$(D) build $(options) --file php70/cli/Dockerfile \
--tag anax/dev:php70 \
--tag anax/dev:php70-cli \
php70/cli
$(D) build $(options) --file php56/cli/Dockerfile \
--tag anax/dev:php56 \
--tag anax/dev:php56-cli \
php56/cli
# target: build-php-apache - Build images php-apache.
.PHONY: build-php-apache
build-php-apache: update
@$(call HELPTEXT,$@)
$(D) build $(options) --file php82/apache/Dockerfile \
--tag anax/dev:php82-apache \
php82/apache
$(D) build $(options) --file php81/apache/Dockerfile \
--tag anax/dev:apache \
--tag anax/dev:latest-apache \
--tag anax/dev:php81-apache \
php81/apache
$(D) build $(options) --file php80/apache/Dockerfile \
--tag anax/dev:php80-apache \
php80/apache
$(D) build $(options) --file php74/apache/Dockerfile \
--tag anax/dev:php74-apache \
php74/apache
$(D) build $(options) --file php73/apache/Dockerfile \
--tag anax/dev:php73-apache \
php73/apache
$(D) build $(options) --file php72/apache/Dockerfile \
--tag anax/dev:php72-apache \
php72/apache
$(D) build $(options) --file php71/apache/Dockerfile \
--tag anax/dev:php71-apache \
php71/apache
$(D) build $(options) --file php70/apache/Dockerfile \
--tag anax/dev:php70-apache \
php70/apache
$(D) build $(options) --file php56/apache/Dockerfile \
--tag anax/dev:php56-apache \
php56/apache
# target: build-remserver - Build images remserver.
.PHONY: build-remserver
build-remserver: update
@$(call HELPTEXT,$@)
$(D) build $(options) \
--file php72/apache/Dockerfile-clone-repo-make-install \
--build-arg REPO=https://github.com/canax/remserver-website.git \
--tag anax/dev:remserver \
--tag anax/dev:remserver-apache \
--tag anax/dev:remserver-php72 \
--tag anax/dev:remserver-php72-apache \
php72/apache
# target: push - Push the docker images to Docker cloud.
.PHONY: push
push:
@$(call HELPTEXT,$@)
# cli
$(D) push anax/dev:php82
$(D) push anax/dev:php82-cli
$(D) push anax/dev:latest
$(D) push anax/dev:cli
$(D) push anax/dev:latest-cli
$(D) push anax/dev:php81
$(D) push anax/dev:php81-cli
$(D) push anax/dev:php80
$(D) push anax/dev:php80-cli
$(D) push anax/dev:php74
$(D) push anax/dev:php74-cli
$(D) push anax/dev:php73
$(D) push anax/dev:php73-cli
$(D) push anax/dev:php72
$(D) push anax/dev:php72-cli
$(D) push anax/dev:php71
$(D) push anax/dev:php71-cli
$(D) push anax/dev:php70
$(D) push anax/dev:php70-cli
$(D) push anax/dev:php56
$(D) push anax/dev:php56-cli
# Apache
$(D) push anax/dev:php82-apache
$(D) push anax/dev:apache
$(D) push anax/dev:latest-apache
$(D) push anax/dev:php81-apache
$(D) push anax/dev:php80-apache
$(D) push anax/dev:php74-apache
$(D) push anax/dev:php73-apache
$(D) push anax/dev:php72-apache
$(D) push anax/dev:php71-apache
$(D) push anax/dev:php70-apache
$(D) push anax/dev:php56-apache
# REM server
$(D) push anax/dev:remserver
$(D) push anax/dev:remserver-apache
$(D) push anax/dev:remserver-php72
$(D) push anax/dev:remserver-php72-apache