-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (43 loc) · 2.04 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
.DEFAULT_GOAL=help
IMAGE_REPO=antonmarin/php
lint: lint-shell lint-dockerfile #? quick pre-build validations
lint-dockerfile:
docker run --rm -tv $(PWD):/app hadolint/hadolint:latest-debian \
sh -c "find . -name Dockerfile | xargs -L1 hadolint"
lint-shell:
docker run --rm -tv "$(PWD):/mnt" koalaman/shellcheck:v0.5.0 \
--color=always --shell=bash --exclude=SC2016 \
**/*.sh
test: #? test all images
$(MAKE) PHP_VERSION=8.1 IMAGE_VARIANT=cli OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=8.1 IMAGE_VARIANT=fpm OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=8.0 IMAGE_VARIANT=cli OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=8.0 IMAGE_VARIANT=fpm OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=7.4 IMAGE_VARIANT=cli OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=7.4 IMAGE_VARIANT=fpm OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=7.3 IMAGE_VARIANT=cli OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=7.3 IMAGE_VARIANT=fpm OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=7.2 IMAGE_VARIANT=cli OS_VERSION=alpine test-single
$(MAKE) PHP_VERSION=7.2 IMAGE_VARIANT=fpm OS_VERSION=alpine test-single
test-single:
docker pull -q php:$(PHP_VERSION)-$(IMAGE_VARIANT)-$(OS_VERSION)
DOCKERFILE_DIR="src/$(PHP_VERSION)/$(OS_VERSION)/$(IMAGE_VARIANT)" && \
docker compose -f $$DOCKERFILE_DIR/docker-compose.test.yml build && \
docker compose -f $$DOCKERFILE_DIR/docker-compose.test.yml run --rm sut
publish:
DOCKERFILE_DIR="src/$(PHP_VERSION)/$(OS_VERSION)/$(IMAGE_VARIANT)" && \
docker build -t "$(IMAGE_REPO):$(PHP_VERSION)-$(OS_VERSION)-$(IMAGE_VARIANT)" -f $$DOCKERFILE_DIR/Dockerfile src && \
docker push "$(IMAGE_REPO):$(PHP_VERSION)-$(OS_VERSION)-$(IMAGE_VARIANT)"
help: #? help me
@printf "\e[34;01mAvailable targets\033[0m\n"
@awk '/^@?[a-zA-Z\-_0-9]+:/ { \
nb = sub( /^#\? /, "", helpMsg ); \
if(nb == 0) { \
helpMsg = $$0; \
nb = sub( /^[^:]*:.* #\? /, "", helpMsg ); \
} \
if (nb) \
printf "\033[1;31m%-" width "s\033[0m %s\n", $$1, helpMsg; \
} \
{ helpMsg = $$0 }' \
$(MAKEFILE_LIST) | column -ts: