-
Notifications
You must be signed in to change notification settings - Fork 1
/
ciki.sh
46 lines (41 loc) · 1.07 KB
/
ciki.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
#!/usr/bin/env bash
usage() {
echo "Usage: $0 [-c <string>] [-m <string>] [-e <string>] [-r <bool>]" 1>&2;
echo "c: path to config"
echo "m: path to migration file directory"
echo "e: environment"
echo "r: revert"
exit 1;
}
while getopts ":c:m:e:r:" o; do
case "${o}" in
c)
c=${OPTARG}
;;
m)
m=${OPTARG}
;;
e)
e=${OPTARG}
;;
r)
r=${OPTARG}
r=$(echo "$r" | awk '{print tolower($0)}')
if ! [[ "$r" = "false" ]] && ! [[ "$r" = "true" ]]; then
usage
fi
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "$c" ] || [ -z "$m" ] || [ -z "$e" ]; then
usage
fi
if [ -z "$r" ] || [[ "$r" = "false" ]]; then
docker run -e env=$e -v $c:/app/src/config/config.json -v $m:/app/src/migrations hepsiburada/cikilop:latest
else
docker run -e env=$e -v $c:/app/src/config/config.json -v $m:/app/src/migrations hepsiburada/cikilop:latest --revert
fi