-
Notifications
You must be signed in to change notification settings - Fork 1
/
dev.sh
executable file
·114 lines (111 loc) · 4.29 KB
/
dev.sh
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
function fn_stop {
echo "[STOP TAINACAN]"
docker compose -f docker-compose.yml down
docker compose -f docker-compose.dev.yml down
docker compose -f docker-compose.nginx.yml down
docker compose -f docker-compose.dev.elastic.yml down
}
function fn_start {
echo "[START TAINACAN]"
docker compose -f docker-compose.yml -f docker-compose.dev.yml up
docker exec -it tainacan_build sh -c "/src_base/scripts/build_plugin.sh --build"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_theme.sh"
}
for i in "$@"
do
case $i in
--build-image)
echo "[BUILD IMAGE]"
docker compose -f docker-compose.yml -f docker-compose.dev.yml build
exit
;;
--build-image-nginx)
echo "[BUILD IMAGE] WITH NGINX"
docker compose -f docker-compose.nginx.yml -f docker-compose.dev.yml docker compose -f build
exit
;;
--build-image-elastic)
echo "[BUILD IMAGE WITH ELASTICSEARCH]"
docker compose -f docker-compose.dev.elastic.yml -f docker-compose.dev.yml -build
exit
;;
--build)
echo "[BUILD TAINACAN]"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_plugin.sh --build"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_theme.sh"
exit
;;
--build-prod)
echo "[BUILD TAINACAN]"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_plugin.sh --build-prod"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_theme.sh"
exit
;;
--watch-build)
echo "[BUILD WATCH TAINACAN]"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_theme.sh"
docker exec -it tainacan_build sh -c "/src_base/scripts/build_plugin.sh --watch-build"
exit
;;
--stop)
fn_stop
exit
;;
--start)
fn_start
exit
;;
--start-nginx)
echo "[START TAINACAN WUTH NGINX]"
docker compose -f docker-compose.nginx.yml -f docker-compose.dev.yml up
exit
;;
--start-elastic)
echo "[START TAINACAN WITH ELASTICSEARCH]"
sysctl -w vm.max_map_count=262144
docker compose -f docker-compose.dev.elastic.yml -f docker-compose.dev.yml up
exit
;;
--run-tests)
echo "[EXECUTANDO TESTES--PHPUnit]"
docker exec -it tainacan_build sh -c "/src_base/scripts/run_tests.sh"
exit
;;
--bash)
echo "[INTO A CONTAINER /bin/bash]"
docker exec -it tainacan_build /bin/bash
exit
;;
--bash-mysql)
echo "[INTO A CONTAINER OF MYSQL /bin/bash]"
docker exec -it tainacan_db /bin/bash
exit
;;
--error-logs)
echo "[ERRORS LOG tainacan-dev]"
docker logs -f tainacan_fpm_apache > /dev/null
exit
;;
--help)
echo "
--build-image = build docker images for application and database (super user).
--build-image-elastic = build docker images for application, database and elasticsearch server (super user).
--build-image-nginx = build docker images for application and database (super user) using nginx
--start = start the containers (super user).
--start-elastic = start the containers and the elastic search server (super user)
--stop = stops all containers(super user).
--run-tests = run phpunit tests (super user).
--bash = enters the container
--bash-mysql = enters the mysql container
--build = builds tainacan plugin and theme (super user).
--watch-build = watches for changes in the plugin and theme and builds them (super user).
--build-prod = builds tainacan plugin and theme (super user) as production mode.
--error-logs = display the error logs
--help = displays this help message
"
exit
;;
esac
done
echo "opção invalida, para ajuda: --help"