-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile.compose.mk
89 lines (65 loc) · 2.11 KB
/
Makefile.compose.mk
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
85
86
87
88
89
# Works only for project root
project := $(shell git rev-parse --show-toplevel)
sail_dir := $(project)/tools/sail
sail := $(sail_dir)/vendor/bin/sail
sail_ci := $(sail) -f docker-compose.ci.yml
sail_test := $(sail) -f docker-compose.test.yml
sail_test_bash := $(sail_test) run --rm application_test bash -c
sail_composer_image = $(shell cat .env.infrastructure.example | grep SAIL_COMPOSER_IMAGE | sed "s/SAIL_COMPOSER_IMAGE=//")
SAIL_COMPOSER_CACHE ?= false
# Application
setup: sail-install build start dependencies-install
$(sail) php artisan app:refresh
sail-install:
${SAIL_COMPOSER_CACHE} || docker run --rm \
--user "$(shell id -u):$(shell id -g)" \
--volume $(sail_dir):/var/www/html \
--workdir /var/www/html \
$(sail_composer_image) \
composer install --ignore-platform-reqs
build:
$(sail) build --pull
dependencies-install:
$(sail) bash -c "make install"
destroy:
$(sail) down --rmi all --volumes --remove-orphans
start:
$(sail) up --detach --build
stop:
$(sail) stop
restart: stop start
# CI
ci-local: prepare-env sail-install
$(sail_ci) up --abort-on-container-exit --attach application_ci --build --pull missing
$(sail_ci) down --volumes
ci: prepare-env sail-install
$(sail_ci) pull --ignore-pull-failures
$(sail_ci) up --abort-on-container-exit --attach application_ci
$(sail_ci) down --volumes
# Tests
infections:
$(sail_test_bash) "make infection"
infections-coverage:
$(sail_test_bash) "make infection-coverage"
tests:
$(sail_test_bash) "make test"
tests-debug:
$(sail_test_bash) "make test-debug"
tests-profile:
$(sail_test_bash) "make test-profile"
tests-coverage:
$(sail_test_bash) "make test-coverage"
# Misc
prepare-env:
test -f .env || sort -u -t '=' -k 1,1 .env.infrastructure.example .env.example | grep -v '^#' > .env
fix-rights:
sudo chown -R $(shell whoami) .
sudo chmod -R 777 storage/
$(sail) php artisan cache:clear
$(sail) composer dump-autoload
fix-phpstan:
cat /dev/null > ./vendor/nesbot/carbon/extension.neon
stack:
$(sail) config > docker-compose.dev.stack.yml
$(sail_test) config > docker-compose.test.stack.yml
$(sail_ci) config > docker-compose.ci.stack.yml