-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·48 lines (37 loc) · 1.13 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·48 lines (37 loc) · 1.13 KB
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
#!/usr/bin/env bash
. /opt/translate/venv/bin/activate
cd /opt/translate/app
export DJANGO_SETTINGS_MODULE=Translation.settings
export LANG=C.UTF-8
ln -fs /usr/share/zoneinfo/${TRANS_TIME_ZONE:-UTC} /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"
if [ ! -v GUNICORN_OPTIONS ] ; then
if [ "${TRANS_DEBUG:-0}" = 1 ] ; then
GUNICORN_OPTIONS=--reload
else
GUNICORN_OPTIONS=--preload
fi
fi
exec gunicorn \
Translation.wsgi:application \
--workers "${GUNICORN_WORKERS:-1}" \
--bind :9000 \
--access-logfile logs/gunicorn-access.log \
--error-logfile logs/gunicorn-error.log \
$GUNICORN_OPTIONS \
>>logs/gunicorn-error.log 2>&1
fi
exec "$@"