Skip to content

Commit d8eccbf

Browse files
committed
Use STAGE instead of FLAVOUR
1 parent 4176a5d commit d8eccbf

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

Makefile

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ TAG = latest
2727
NAME = PHP
2828
#VERSION = 5.5
2929
IMAGE = devilbox/php-fpm
30-
#FLAVOUR = base
30+
#FLAVOUR = debian
31+
#STAGE = base
3132
FILE = Dockerfile-$(VERSION)
32-
DIR = Dockerfiles/$(FLAVOUR)
33+
DIR = Dockerfiles/$(STAGE)
3334

3435
ifeq ($(strip $(TAG)),latest)
35-
DOCKER_TAG = $(VERSION)-$(FLAVOUR)
36+
DOCKER_TAG = $(VERSION)-$(STAGE)
3637
BASE_TAG = $(VERSION)-base
3738
MODS_TAG = $(VERSION)-mods
3839
PROD_TAG = $(VERSION)-prod
3940
WORK_TAG = $(VERSION)-work
4041
else
41-
DOCKER_TAG = $(VERSION)-$(FLAVOUR)-$(TAG)
42+
DOCKER_TAG = $(VERSION)-$(STAGE)-$(TAG)
4243
BASE_TAG = $(VERSION)-base-$(TAG)
4344
MODS_TAG = $(VERSION)-mods-$(TAG)
4445
PROD_TAG = $(VERSION)-prod-$(TAG)
@@ -116,41 +117,41 @@ lint-ansible: gen-dockerfiles
116117
# the variable directory of extensions to copy.
117118
# The only way to "LAZY" fetch it, is by doing a call to the base image and populate
118119
# a Makefile variable with its value upon call.
119-
ifeq ($(strip $(FLAVOUR)),mods)
120+
ifeq ($(strip $(STAGE)),mods)
120121
EXT_DIR=$$( docker run --rm --platform $(ARCH) --entrypoint=php $(IMAGE):$(BASE_TAG) -r \
121122
'echo ini_get("extension_dir");'\
122123
)
123124
endif
124125

125126
.PHONY: build
126-
build: check-flavour-is-set
127+
build: check-stage-is-set
127128
build: check-parent-image-exists
128129
build: ARGS+=--build-arg EXT_DIR=$(EXT_DIR)
129130
build: docker-arch-build
130131

131132
.PHONY: rebuild
132-
rebuild: check-flavour-is-set
133+
rebuild: check-stage-is-set
133134
rebuild: check-parent-image-exists
134135
rebuild: ARGS+=--build-arg EXT_DIR=$(EXT_DIR)
135136
rebuild: docker-arch-rebuild
136137

137138
.PHONY: push
138-
push: check-flavour-is-set
139+
push: check-stage-is-set
139140
push: check-version-is-set
140141
push: docker-arch-push
141142

142143
.PHONY: tag
143-
tag: check-flavour-is-set
144+
tag: check-stage-is-set
144145
tag: check-version-is-set
145146
tag:
146-
docker tag $(IMAGE):$(VERSION)-$(FLAVOUR) $(IMAGE):$(DOCKER_TAG)
147+
docker tag $(IMAGE):$(VERSION)-$(STAGE) $(IMAGE):$(DOCKER_TAG)
147148

148149

149150
# -------------------------------------------------------------------------------------------------
150151
# Save / Load Targets
151152
# -------------------------------------------------------------------------------------------------
152153
.PHONY: save
153-
save: check-flavour-is-set
154+
save: check-stage-is-set
154155
save: check-version-is-set
155156
save: check-current-image-exists
156157
save: docker-save
@@ -177,13 +178,13 @@ manifest-push: docker-manifest-push
177178
# Test Targets
178179
# -------------------------------------------------------------------------------------------------
179180
.PHONY: test
180-
test: check-flavour-is-set
181+
test: check-stage-is-set
181182
test: check-current-image-exists
182183
test: test-integration
183184

184185
.PHONY: test-integration
185186
test-integration:
186-
./tests/test.sh $(IMAGE) $(ARCH) $(VERSION) $(FLAVOUR) $(DOCKER_TAG)
187+
./tests/test.sh $(IMAGE) $(ARCH) $(VERSION) $(STAGE) $(DOCKER_TAG)
187188

188189

189190
# -------------------------------------------------------------------------------------------------
@@ -240,17 +241,17 @@ check-version-is-set:
240241
fi
241242

242243
###
243-
### Ensures the FLAVOUR variable is set
244+
### Ensures the STAGE variable is set
244245
###
245-
.PHONY: check-flavour-is-set
246-
check-flavour-is-set:
247-
@if [ "$(FLAVOUR)" = "" ]; then \
248-
echo "This make target requires the FLAVOUR variable to be set."; \
249-
echo "make <target> FLAVOUR="; \
246+
.PHONY: check-stage-is-set
247+
check-stage-is-set:
248+
@if [ "$(STAGE)" = "" ]; then \
249+
echo "This make target requires the STAGE variable to be set."; \
250+
echo "make <target> STAGE="; \
250251
echo "Exiting."; \
251252
exit 1; \
252253
fi
253-
@if [ "$(FLAVOUR)" != "base" ] && [ "$(FLAVOUR)" != "mods" ] && [ "$(FLAVOUR)" != "prod" ] && [ "$(FLAVOUR)" != "work" ]; then \
254+
@if [ "$(STAGE)" != "base" ] && [ "$(STAGE)" != "mods" ] && [ "$(STAGE)" != "prod" ] && [ "$(STAGE)" != "work" ]; then \
254255
echo "Error, Flavour can only be one of 'base', 'mods', 'prod', or 'work'."; \
255256
echo "Exiting."; \
256257
exit 1; \
@@ -260,7 +261,7 @@ check-flavour-is-set:
260261
### Checks if current image exists and is of correct architecture
261262
###
262263
.PHONY: check-current-image-exists
263-
check-current-image-exists: check-flavour-is-set
264+
check-current-image-exists: check-stage-is-set
264265
check-current-image-exists:
265266
@if [ "$$( docker images -q $(IMAGE):$(DOCKER_TAG) )" = "" ]; then \
266267
>&2 echo "Docker image '$(IMAGE):$(DOCKER_TAG)' was not found locally."; \
@@ -286,9 +287,9 @@ check-current-image-exists:
286287
### Checks if parent image exists and is of correct architecture
287288
###
288289
.PHONY: check-parent-image-exists
289-
check-parent-image-exists: check-flavour-is-set
290+
check-parent-image-exists: check-stage-is-set
290291
check-parent-image-exists:
291-
@if [ "$(FLAVOUR)" = "work" ]; then \
292+
@if [ "$(STAGE)" = "work" ]; then \
292293
if [ "$$( docker images -q $(IMAGE):$(PROD_TAG) )" = "" ]; then \
293294
>&2 echo "Docker image '$(IMAGE):$(PROD_TAG)' was not found locally."; \
294295
>&2 echo "Either build it first or explicitly pull it from Dockerhub."; \
@@ -304,7 +305,7 @@ check-parent-image-exists:
304305
>&2 echo; \
305306
exit 1; \
306307
fi; \
307-
elif [ "$(FLAVOUR)" = "prod" ]; then \
308+
elif [ "$(STAGE)" = "prod" ]; then \
308309
if [ "$$( docker images -q $(IMAGE):$(MODS_TAG) )" = "" ]; then \
309310
>&2 echo "Docker image '$(IMAGE):$(MODS_TAG)' was not found locally."; \
310311
>&2 echo "Either build it first or explicitly pull it from Dockerhub."; \
@@ -320,7 +321,7 @@ check-parent-image-exists:
320321
>&2 echo; \
321322
exit 1; \
322323
fi; \
323-
elif [ "$(FLAVOUR)" = "mods" ]; then \
324+
elif [ "$(STAGE)" = "mods" ]; then \
324325
if [ "$$( docker images -q $(IMAGE):$(BASE_TAG) )" = "" ]; then \
325326
>&2 echo "Docker image '$(IMAGE):$(BASE_TAG)' was not found locally."; \
326327
>&2 echo "Either build it first or explicitly pull it from Dockerhub."; \

0 commit comments

Comments
 (0)