-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-docker.sh
executable file
·65 lines (53 loc) · 1 KB
/
run-docker.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
#!/usr/bin/env bash
SERVICES='timestamps-application'
build() {
for service in $SERVICES
do
cd $service
docker_file=src/deployment/Dockerfile
echo "Building image from Docker file $docker_file"
docker build -t $service:$VERSION -f $docker_file .
cd ..
done
}
start() {
docker run -d -p 8950:8950 --name timestamps-application timestamps-application:latest
}
stop() {
for service in $SERVICES
do
docker stop $service
done
}
remove() {
for service in $SERVICES
do
docker rm $service
done
}
if [ -n "$2" ];
then
echo "Using version: '$2'"
VERSION=$2;
else
echo "Using latest version"
VERSION=latest;
fi
case "$1" in
build)
build
;;
start)
start
;;
stop)
stop
;;
restart)
stop
remove
start
;;
*)
echo "USAGE: run-docker build|start|stop|restart [VERSION]"
esac