-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·53 lines (46 loc) · 1 KB
/
entrypoint.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
#!/bin/bash
set -e
: ${TONA_ENV:=${TONA_ENV:="production"}}
: ${TONA_TZ:=${TONA_TZ:='UTC'}}
: ${TONA_STORAGE:=${TONA_STORAGE:="/tona/storage"}}
ARGS=()
function add_arg(){
ARGS+=("$1")
ARGS+=("$2")
}
function clean_build(){
dirs=('./build' './dist' './tona.egg-info')
for dir in "${dirs[@]}"; do
if [ -d "$dir" ]; then
rm -r $dir
fi
done
}
case "$1" in
--prod | tona )
add_arg "--time-zone" "$TONA_TZ"
add_arg "--storage" "$TONA_STORAGE"
export TONA_ENV=$TONA_ENV
exec tona webapp "${ARGS[@]}"
;;
--dev)
export TONA_ENV=dev
exec python3 main.py webapp -d --storage storage --time-zone $(cat /etc/timezone)
;;
--install)
python3 setup.py install
;;
--upgrade)
pip uninstall tona
clean_build
python3 setup.py install
;;
--uninstall)
pip uninstall tona
clean_build
;;
*)
exec "$@"
;;
esac
exit 1