-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
84 lines (65 loc) · 3.18 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
.PHONY: help
# List all available Makefile commands.
help:
@echo "Available commands:"
@echo " make help : List all available Makefile commands"
@echo " make setup-php81 : Start the dev environment with PHP 8.1"
@echo " make setup-php82 : Start the dev environment with PHP 8.2"
@echo " make setup-php83 : Start the dev environment with PHP 8.3"
@echo " make shell : Get an interactive shell on the PHP container"
@echo " make static-analysis : Run Static Analysis (PHPStan)"
@echo " make coding-standards : Run Coding Standards (PHP-CS-Fixer)"
@echo " make start-containers : Start the dev environment"
@echo " make stop-containers : Stop the dev environment"
@echo " make kill-containers : Stop and remove all containers"
@echo " make composer-install : Install composer dependencies"
# Typing 'make setup-php81' will start the dev environment with PHP 8.1
setup-php81: stop-containers --prep-dockerfile-php81 start-containers --remove-packages composer-install
# Typing 'make setup-php82' will start the dev environment with PHP 8.2
setup-php82: stop-containers --prep-dockerfile-php82 start-containers --remove-packages composer-install
# Typing 'make setup-php83' will start the dev environment with PHP 8.3
setup-php83: stop-containers --prep-dockerfile-php83 start-containers --remove-packages composer-install
# Get a shell on the PHP container
shell:
docker compose exec -it provision-provider-domain-names /bin/bash
# Run Static Analysis (PHPStan)
static-analysis:
docker compose exec provision-provider-domain-names ./vendor/bin/phpstan analyse --memory-limit=1G
coding-standards:
docker compose exec provision-provider-domain-names php ./bin/php-cs-fixer-v3.phar fix --config=./.php-cs-fixer.dist.php
# Start the dev environment
start-containers:
docker compose up -d --build
# Stop the dev environment
stop-containers:
docker compose down
# Stop and remove all containers
kill-containers:
docker compose kill
docker compose rm --force
# Install composer dependencies
composer-install:
docker compose exec provision-provider-domain-names composer install --no-interaction
# Copy Dockerfile for PHP 8.1
--prep-dockerfile-php81: --remove-dockerfile --prep-docker-compose-file
cp "./.docker/Dockerfile.php81" "./.docker/Dockerfile"
# Copy Dockerfile for PHP 8.2
--prep-dockerfile-php82: --remove-dockerfile --prep-docker-compose-file
cp "./.docker/Dockerfile.php82" "./.docker/Dockerfile"
# Copy Dockerfile for PHP 8.3
--prep-dockerfile-php83: --remove-dockerfile --prep-docker-compose-file
cp "./.docker/Dockerfile.php83" "./.docker/Dockerfile"
# Copy docker-compose.yml file
--prep-docker-compose-file:
[ -f "./docker-compose.yml" ] || cp "./docker-compose.yml.example" "./docker-compose.yml"
# Remove Dockerfile
--remove-dockerfile:
rm -f ./docker/Dockerfile
# Remove composer related files
--remove-packages: --remove-lockfile --remove-vendor
# Remove composer.lock file
--remove-lockfile:
docker compose exec provision-provider-domain-names rm -f ./composer.lock
# Remove vendor directory
--remove-vendor:
docker compose exec provision-provider-domain-names rm -rf ./vendor