-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (53 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
ifneq (,$(wildcard ./.env))
include .env
export
endif
# Run this command first
init: configs-setup builds-setup override-config composer-install db-create db-migrations permissions-fix
up: docker-up
down: docker-down
restart: down up
rebuild: down docker-build
reset: rebuild up
docker-up:
docker-compose -p $(DOCKER_PROJECT_TITLE) up -d
@echo ***Success! Your app is ready and available at http://localhost:$(DOCKER_NGINX_PORT) and you can connect PostgreSQL from your host machine on port $(DOCKER_POSTGRESQL_PORT).***
docker-down:
docker-compose -p $(DOCKER_PROJECT_TITLE) down --remove-orphans
docker-down-clear:
docker-compose -p $(DOCKER_PROJECT_TITLE) down -v --remove-orphans
docker-pull:
docker-compose -p $(DOCKER_PROJECT_TITLE) pull
docker-build:
docker-compose -p $(DOCKER_PROJECT_TITLE) build
test:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli php /app/bin/phpunit
composer-install:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli sh -c "umask 002 && composer install --no-interaction"
console:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli zsh
cs:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli sh -c "php /app/vendor/bin/php-cs-fixer -v --allow-risky=yes --config=/app/.php_cs.dist fix /app/src/* /app/tests/*"
psalm:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli sh -c "php /app/vendor/bin/psalm /app/src/*"
db-create:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli sh -c "php /app/bin/console doctrine:database:create --if-not-exists"
db-migrations:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli sh -c "php /app/bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration"
permissions-fix:
docker-compose -p $(DOCKER_PROJECT_TITLE) run --rm php-cli sh -c "chmod -R u+rwX,g+w,go+rX,o-w .; [ -d ./var/log ] && chmod -R 777 ./var/log; [ -d ./var/cache ] && chmod -R 777 ./var/cache; chmod -R o+rX ./public"
configs-setup:
rm -r ./vendor composer.json composer.lock RUN_MAKE_INIT_COMMAND_PLEASE.md || true # Remove template root composer files, keep only the ./app ones
[ -f docker-compose.override.yaml ] && echo "Skip docker-compose.override.yaml" || cp docker-compose.override.yaml.dist docker-compose.override.yaml
[ -f ./app/.env.local ] && echo "Skip .env.local" || cp ./app/.env ./app/.env.local
builds-setup:
./build_scripts/override_default_docker_env_vars.sh || true # Set random project title and host ports for Nginx/PostgreSQL
rm -r ./build_scripts || true
override-config:
[ -f ./.env ] && echo "Skip docker .env" || cp ./.env.dist ./.env
[ -f ./app/phpunit.xml ] && echo "Skip phpunit.xml" || cp ./app/phpunit.xml.dist ./app/phpunit.xml
[ -d ./app/var/data/.composer ] && echo "./var/data/.composer exists" || mkdir -p ./app/var/data/.composer
[ -f ./app/var/data/.composer/auth.json ] && echo "Skip ./var/data/.composer/auth.json" || echo '{}' > ./app/var/data/.composer/auth.json
prepare-commit-msg:
[ -d ./.git/hooks ] && echo "./.git/hooks exists" || mkdir -p .git/hooks
[ -f .git/hooks/prepare-commit-msg ] && echo "Skip .hooks/prepare-commit-msg" || cp docker/dev/hooks/prepare-commit-msg .git/hooks/prepare-commit-msg && chmod +x .git/hooks/prepare-commit-msg