-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (74 loc) · 2.14 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
85
86
87
88
89
90
91
92
93
94
.DEFAULT_GOAL := help
## -- MAKEFILE INFO --
## This help message
.PHONY: help
help:
@printf "Usage: make <target>\n";
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (helpMessage) { \
helpMessage = helpMessage"\n "substr($$0, 3); \
} else { \
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
print "\n "helpMessage"\n" \
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)
## -- DOCKER SETUP --
.PHONY: project-build project-start project-stop project-down project-destroy
## Build and start the project
project-build:
docker-compose up --build -d
## Start the project
project-start:
docker-compose up -d --no-recreate
## Stop the project
project-stop:
docker-compose stop
## Stop the project and remove containers
project-down:
docker-compose down --remove-orphans
## Completely remove the project (containers, images, volumes)
project-destroy:
docker-compose down --rmi local --volumes --remove-orphans
## -- SHELL ACCESS --
.PHONY: sh-web sh-php sh-php-su sh-node
## Connect to the nginx container as uid 1000
sh-web:
docker-compose exec -u 1000 nginx /bin/sh
## Connect to the php container as default user
sh-php:
docker-compose exec php /bin/sh
## Connect to the php container as root user
sh-php-su:
docker-compose exec -u root php /bin/sh
## Connect to the node container as uid 1000
sh-node:
docker-compose exec -u 1000 node /bin/sh
## -- YARN --
.PHONY: assets-compile assets-compile-watch
## Compile assets once
assets-compile:
docker-compose exec -u 1000 node yarn encore dev
## Recompile assets automatically when file change
assets-watch:
docker-compose exec -u 1000 node yarn encore dev --watch