-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
69 lines (58 loc) · 2.25 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
USERID = `id -u`
USERNAME = `id -un`
GROUPID = `id -g`
GROUPNAME = `id -gn`
default: help
help:
@echo "\n\
\e[1;1;33mSome Help needed?\e[0m\n\n\
\e[1;1;32mmake setup\e[0m - Prefills the .env file with sync required parameters \n\
and prepares all modifieble custom files from dist. Run this \n\
once before everything!\n\n\
\e[1;1;32mmake addbasicservices\e[0m - Adds php, apache and mysql services \n\
\e[1;1;32mmake file=... addservice\e[0m - Prepend file contents to current docker-compose.yml file\n\n\
\e[1;1;32mmake up\e[0m - Start all configured containers (have you run setup command already?)!\n\
\e[1;1;32mmake down\e[0m - Stop all configured containers\n\n\
\e[1;1;32mmake example\e[0m - Setup basic services + Runs example recipe\n\n\
\e[1;1;32mmake php\e[0m - Connect to php container shell\n\
\e[1;1;32mmake node\e[0m - Connect to node container shell\n\
"
setup:
@cat .env.dist | \
sed "s/<userId>/$(USERID)/;\
s/<userName>/$(USERNAME)/;\
s/<groupId>/$(GROUPID)/;\
s/<groupName>/$(GROUPNAME)/"\
> .env
@cp -n containers/httpd/project.conf.dist containers/httpd/project.conf
@cp -n containers/php-fpm/custom.ini.dist containers/php-fpm/custom.ini
@cp -n docker-compose.yml.dist docker-compose.yml
@echo "Setup done! Add basic services with \e[1;1;32mmake addbasicservices\e[0m and start everything \e[1;1;32mmake up\e[0m"
reset:
-make down
-[ -e ".env" ] && rm .env
-[ -e "containers/httpd/project.conf" ] && rm containers/httpd/project.conf
-[ -e "containers/php-fpm/custom.ini" ] && rm containers/php-fpm/custom.ini
-[ -e "docker-compose.yml" ] && rm docker-compose.yml
-rm -rf data/mysql/*
-[ -d source ] && rm -rf source
@echo "Reset done."
example:
@./recipes/default/example/run.sh
up:
docker compose up --build -d --wait
down:
docker compose down --remove-orphans
php:
docker compose exec php bash
node:
docker compose run --rm node bash
addservice:
@cat $(file) >> docker-compose.yml
@echo "\n" >> docker-compose.yml
@echo "Service file $(file) contents added\n";
addbasicservices:
@make file=services/apache.yml addservice
@make file=services/php.yml addservice
@make file=services/mysql.yml addservice
@echo "php, apache and mysql related services added\n";