-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.sh
executable file
·51 lines (42 loc) · 997 Bytes
/
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
# 使い方:
# Dcokcer起動[Up]
# ./docker.sh -u
#
# Dcokcer終了[Down]
# ./docker.sh -d
#!/bin/zsh
# shopt -s expand_aliases
# source ~/.zshrc
SCRIPT_DIR=$(cd $(dirname $0); pwd)
cd $SCRIPT_DIR
abort() { echo "$*" >&2; exit 1; }
unknown() { abort "unrecognized option '$1'"; }
required() { [ $# -gt 1 ] || abort "option '$1' requires an argument"; }
IS_LIMA=`which lima`
# echo ${IS_LIMA}
if ! echo "${IS_LIMA}" | grep -q "/lima"; then
# echo "lima not found"
DOCKER_COMPOSE="docker-compose"
else
# echo "lima found"
DOCKER_COMPOSE="lima nerdctl compose"
fi
ARG_ENV=''
up() {
echo "up ..."
# docker-compose -f ./prov/docker/docker-compose.yml up -d --build
${DOCKER_COMPOSE} -f ./prov/docker/docker-compose.yml up -d
}
down() {
echo "down ..."
${DOCKER_COMPOSE} -f ./prov/docker/docker-compose.yml down
}
while [ $# -gt 0 ]; do
case $1 in
-u | --up ) up ;;
-d | --down ) down ;;
-?*) unknown "$@" ;;
*) break
esac
shift
done