forked from ioi-2019/ioi-translation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·42 lines (29 loc) · 1.01 KB
/
docker-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
#!/usr/bin/env bash
cd /usr/src/app
export DJANGO_SETTINGS_MODULE=Translation.settings
export LANG=C.UTF-8
# added by Emil Abbasov (IOI2019) to fix the container timezone issue
# set noninteractive installation
export DEBIAN_FRONTEND=noninteractive
#install tzdata package
apt-get install -y tzdata
# set your timezone
ln -fs /usr/share/zoneinfo/Asia/Baku /etc/localtime
dpkg-reconfigure --frontend noninteractive tzdata
fc-cache
if [[ -n $DB_HOST ]]; then
while ! timeout 2 bash -c "cat < /dev/null > /dev/tcp/$DB_HOST/5432" 2> /dev/null; do
echo "Waiting for db..."
sleep 1
done
fi
if [[ $# -eq 0 ]]; then
echo "Collecting staticfiles"
python3 manage.py collectstatic --noinput
echo "Migrating Models"
python3 manage.py migrate
echo "Starting Gunicorn"
# For using docker in development settings, add `--reload` option below to the execution line of gunicorn
exec /usr/local/bin/gunicorn Translation.wsgi:application -w "${GUNICORN_WORKERS:-1}" -b :9000
fi
exec "$@"