-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
74 lines (69 loc) · 2.44 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
# HELP
# This will output the help for each task
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
THIS_FILE := $(lastword $(MAKEFILE_LIST))
PHP_VERSION ?= "7.4"
%:
@echo ""
all:
@echo ""
build:
@if [ "$$(docker images -q php:$(PHP_VERSION)-cli-ext 2>/dev/null)" = "" ]; then \
cd $$(pwd)/docker/php-cli-ext && docker build --build-arg PHP_VERSION=$(PHP_VERSION) -t php:$(PHP_VERSION)-cli-ext .; \
fi
run:
$(MAKE) build
docker run --rm -it \
-v $$(pwd):/srv/$$(basename "`pwd`") \
-w /srv/$$(basename "`pwd`") \
--user "$$(id -u):$$(id -g)" \
--name $$(basename "`pwd`")_cli \
php:$(PHP_VERSION)-cli-ext $(filter-out $@,$(MAKECMDGOALS))
unittest:
$(MAKE) build
docker run --rm -it \
-v $$(pwd):/srv/$$(basename "`pwd`") \
-w /srv/$$(basename "`pwd`") \
--user "$$(id -u):$$(id -g)" \
--name $$(basename "`pwd`")_cli \
php:$(PHP_VERSION)-cli-ext vendor/bin/phpunit --verbose --debug tests
composer-install:
docker run --rm -it \
-v $$(pwd):/srv/$$(basename "`pwd`") \
-w /srv/$$(basename "`pwd`") \
-e COMPOSER_HOME="/srv/$$(basename "`pwd`")/.composer" \
--user $$(id -u):$$(id -g) \
composer composer install -v --no-plugins --no-scripts --prefer-dist
composer-update:
docker run --rm -it \
-v $$(pwd):/srv/$$(basename "`pwd`") \
-w /srv/$$(basename "`pwd`") \
-e COMPOSER_HOME="/srv/$$(basename "`pwd`")/.composer" \
--user $$(id -u):$$(id -g) \
composer composer update -v --no-plugins --no-scripts --prefer-dist
composer-require:
docker run --rm -it \
-v $$(pwd):/srv/$$(basename "`pwd`") \
-w /srv/$$(basename "`pwd`") \
-e COMPOSER_HOME="/srv/$$(basename "`pwd`")/.composer" \
--user $$(id -u):$$(id -g) \
composer composer require -v --no-plugins --no-scripts --prefer-dist $(filter-out $@,$(MAKECMDGOALS))
composer:
docker run --rm -it \
-v $$(pwd):/srv/$$(basename "`pwd`") \
-w /srv/$$(basename "`pwd`") \
-e COMPOSER_HOME="/srv/$$(basename "`pwd`")/.composer" \
--user $$(id -u):$$(id -g) \
composer composer $(filter-out $@,$(MAKECMDGOALS))
security-check:
$(MAKE) -s build
docker run --rm -it \
-v $$(pwd):/app \
phpstan:${PHP_VERSION} analyse || true
docker run --rm -it \
-v $$(pwd):/app \
-w /app \
symfonycorp/cli security:check || true