-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-cli
More file actions
executable file
·56 lines (49 loc) · 1.01 KB
/
docker-cli
File metadata and controls
executable file
·56 lines (49 loc) · 1.01 KB
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
#! /bin/bash
cd "$(dirname "$(readlink -f $0)")"
function help () {
echo "Usage: docker.sh [action] [env] [comand]"
echo " action: build, up, down"
echo " command: run, serve, interactive"
}
function down () {
is_running=$(docker ps -a | grep icqa_waves_1 | grep -Eo '^[^ ]+')
if ! [ -z "$is_running" ];
then
docker stop $is_running
docker rm $is_running
fi
}
function up () {
if [ "$1" == "run" ]
then
bind="-d"
else
bind="-it"
fi
if [ "$1" == "run" ] || [ "$1" == "serve" ] || [ "$1" == "interactive" ];
then
down
docker run $bind -v /var/log:/var/log -p 5050:5000 --name icqa_waves_1 -h icqa_waves icqa_waves:latest $1
else
echo "ERROR: Unkown command $1"
help
fi
}
action=$1
cmd=$2
if [ "$action" == "-h" ] || [ "$action" == "--help" ];
then
help
elif [ "$action" == "build" ];
then
docker build -t icqa_waves:latest .
elif [ "$action" == "up" ];
then
up $cmd
elif [ "$action" == "down" ];
then
down
else
echo "ERROR: Unknown action $action"
help
fi