-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
67 lines (49 loc) · 1.67 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
UNAME := $(shell uname)
AUTOLOAD = vendor/autoload.php
CERTS_DIR = .certs
DOCKER_COMPOSE = docker-compose
DOCKER_COMPOSE_FLAGS = -f docker/docker-compose.yaml -f docker/docker-compose-dev.yaml --env-file docker/.env
MKCERT = mkcert
docker-compose = $(DOCKER_COMPOSE) $(DOCKER_COMPOSE_FLAGS) $1
docker-exec = $(call docker-compose,exec -T app /bin/bash -c "$1")
.PHONY: up composer build halt destroy ssh certs provision composer-install \
composer-normalize phpstan php-cs-fixer phpunit phpunit-coverage database
# Docker
up: compose $(AUTOLOAD)
compose: $(CERTS_DIR)
ifeq ($(UNAME), Darwin)
SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock $(call docker-compose,up -d)
else
$(call docker-compose,up -d)
endif
build: halt
$(call docker-compose,build)
halt:
$(call docker-compose,stop)
destroy:
$(call docker-compose,down --remove-orphans)
ssh:
$(call docker-compose,exec app /bin/bash)
$(CERTS_DIR):
$(MAKE) certs
certs:
mkdir -p $(CERTS_DIR)
$(MKCERT) -install
$(MKCERT) -cert-file $(CERTS_DIR)/certificate.pem -key-file $(CERTS_DIR)/certificate-key.pem localhost
# App
$(AUTOLOAD):
$(MAKE) provision
provision: composer-install database
composer-install:
$(call docker-exec,composer install --optimize-autoloader)
composer-normalize:
$(call docker-exec,composer normalize)
phpstan:
$(call docker-exec,composer phpstan)
php-cs-fixer:
$(call docker-exec,composer php-cs-fixer)
database:
$(call docker-exec,console doctrine:database:drop --no-interaction --force)
$(call docker-exec,console doctrine:database:create --no-interaction)
# $(call docker-exec,console doctrine:database:import docker/dump.sql)
$(call docker-exec,console doctrine:migrations:migrate --no-interaction)