-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·66 lines (51 loc) · 1.33 KB
/
build.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
#!/usr/bin/env bash
##############################################################################
# #
# Script to build the containers for the Performance Dashboard #
# #
##############################################################################
function usage() {
echo "Usage: $0 <kind> <operaion>"
echo ""
echo " kind : the kind of deployment : prod | dev"
echo " operation : the operation on the deployment : build | run | stop"
}
function run() {
docker-compose up -d
}
function stop() {
docker-compose down
}
function build () {
if [[ $1 == "prod" ]] ; then
cp -r ../../html .
fi
docker-compose build --no-cache
if [[ $1 == "prod" ]] ; then
rm -rf html
fi
}
if [[ $# -ne 2 ]] ; then
usage
exit 1
fi
deployment=$1
if [[ $deployment != "dev" && $deployment != "prod" ]] ; then
usage
exit 2
fi
echo "Going to create $deployment deployment !"
cd infra/$deployment
if [[ $? -ne 0 ]] ; then
echo "The script must run from the main repo. directory !"
exit 3
fi
if [[ $2 == "run" ]] ; then
run
fi
if [[ $2 == "stop" ]] ; then
stop
fi
if [[ $2 == "build" ]] ; then
build $deployment
fi