generated from isystk/lambda-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdc.sh
executable file
·99 lines (82 loc) · 2 KB
/
dc.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /bin/bash
DOCKER_HOME=./docker
DOCKER_COMPOSE="docker-compose -f $DOCKER_HOME/docker-compose.yml"
function usage {
cat <<EOF
$(basename ${0}) is a tool for ...
Usage:
$(basename ${0}) [command] [<options>]
Options:
stats|st Dockerコンテナの状態を表示します。
init Dockerコンテナ・イメージ・生成ファイルの状態を初期化します。
start すべてのDaemonを起動します。
stop すべてのDaemonを停止します。
console login コンソールにログインします。
frontend login frontendにログインします。
backend login backendにログインします。
--version, -v バージョンを表示します。
--help, -h ヘルプを表示します。
EOF
}
function version {
echo "$(basename ${0}) version 0.0.1 "
}
case ${1} in
stats|st)
docker container stats
;;
init)
# 停止&削除(コンテナ・イメージ・ボリューム)
pushd $DOCKER_HOME
docker-compose down --rmi all --volumes
;;
start)
$DOCKER_COMPOSE up -d
;;
stop)
pushd $DOCKER_HOME
docker-compose down
popd
;;
console)
case ${2} in
login)
$DOCKER_COMPOSE exec console /bin/bash
;;
*)
usage
;;
esac
;;
frontend)
case ${2} in
login)
$DOCKER_COMPOSE exec frontend /bin/bash
;;
*)
usage
;;
esac
;;
backend)
case ${2} in
login)
$DOCKER_COMPOSE exec backend /bin/bash
;;
*)
usage
;;
esac
;;
help|--help|-h)
usage
;;
version|--version|-v)
version
;;
*)
echo "[ERROR] Invalid subcommand '${1}'"
usage
exit 1
;;
esac