-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscripts.sh
executable file
·69 lines (61 loc) · 1.16 KB
/
scripts.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
#!/bin/sh
set -e
MYSQL_USERNAME=root
MYSQL_PASSWORD=root
waitdbstartup() {
while [ true ]
do
sudo docker-compose run --rm dbc mysql -h db -u $MYSQL_USERNAME --password=$MYSQL_PASSWORD --execute="SHOW DATABASES;" > /dev/null
RET=$?
if [ "$RET" = "0" ]
then
break
fi
sleep 1
done
}
build() {
echo "Pulling images, this may take several minutes."
sudo docker-compose pull
sudo docker-compose build
}
compile() {
sudo docker-compose run --rm maven mvn clean compile package
}
start() {
sudo docker-compose up -d db
waitdbstartup
sudo docker-compose up -d tomcat
echo "Done, please open http://localhost:8080/annotationTool in browser."
}
stop() {
sudo docker-compose stop
}
status() {
sudo docker-compose ps
}
case "$1" in
build)
build
;;
compile)
compile
;;
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {build|compile|start|stop|restart|status}"
exit 1
;;
esac