-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgarlicoin.sh
executable file
·47 lines (41 loc) · 1.06 KB
/
garlicoin.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
#!/bin/bash
FORCE_BUILD=0
print_help() {
echo "Usage: ./garlicoin.sh -[f] -[c|b] [options]"
echo " -c [dev | release] : Connect to running docker machine"
echo " -s [dev | release] : Build and/or start and Garlicoin container"
echo " -f : Force build when starting docker"
}
parse_connect() {
if [ $1 == "dev" ]; then
echo "dev"
docker exec -it garlicoin_development_1 bash
elif [ $1 == "release" ]; then
echo "release"
docker exec -it garlicoin_release_1 bash
else
print_help
exit 0
fi
}
parse_start() {
if [ $1 == "dev" ]; then
FORCE_BUILD=$FORCE_BUILD docker-compose -f dev-compose.yml up --build
elif [ $1 == "release" ]; then
FORCE_BUILD=$FORCE_BUILD docker-compose up --build
else
print_help
exit 0
fi
}
while getopts "fc:s:" ENV; do
case $ENV in
f) FORCE_BUILD=1;;
c) parse_connect $OPTARG; exit 0;;
s) parse_start $OPTARG; exit 0;;
?) print_help; exit 2;;
esac
done
if [ $# -eq 0 ]; then
print_help
fi