-
Notifications
You must be signed in to change notification settings - Fork 7
/
run.sh
62 lines (55 loc) · 1.13 KB
/
run.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
#!/bin/bash
build(){
docker-compose down
docker-compose build
}
run(){
docker-compose down
docker-compose up -d
}
check_dependencies_and_run(){
command -v docker >/dev/null 2>&1 || {
echo >&2 "You need to install Docker first"; return 0;
}
command -v docker-compose >/dev/null 2>&1 || {
echo >&2 "Can not find docker-compose command"; return 0;
}
run &
open http://localhost
}
check_dependencies_build_and_run(){
command -v docker >/dev/null 2>&1 || {
echo >&2 "You need to install Docker first"; return 0;
}
command -v docker-compose >/dev/null 2>&1 || {
echo >&2 "Can not find docker-compose command"; return 0;
}
build
run &
open http://localhost
}
generate_api_doc(){
cd app/
apidoc -i ./routes/ -o ../apidoc
cd ..
}
run_dev(){
docker-compose down
docker-compose up db &
cd app
bash start.sh &
cd ..
sleep 10
open http://localhost:3000
}
if [ $1 == "build" ]; then
check_dependencies_build_and_run
elif [ $1 == "run" ]; then
check_dependencies_and_run
elif [ $1 == "apidoc" ]; then
generate_api_doc
elif [ $1 == "dev" ]; then
run_dev
else
echo "Unknown command";
fi