-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-run.sh
48 lines (37 loc) · 1014 Bytes
/
docker-run.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
#!/bin/bash
cd /app/
if [[ "$SETTINGS" ]]; then
export DJANGO_SETTINGS_MODULE="$APP.$SETTINGS"
else
export DJANGO_SETTINGS_MODULE="$APP.settings_docker"
fi
if [ "$1" == "migrate" ]; then
exec /ve/bin/python manage.py migrate --noinput
fi
if [ "$1" == "collectstatic" ]; then
exec /ve/bin/python manage.py collectstatic --noinput
fi
if [ "$1" == "compress" ]; then
exec /ve/bin/python manage.py compress
fi
if [ "$1" == "shell" ]; then
exec /ve/bin/python manage.py shell
fi
if [ "$1" == "worker" ]; then
exec /ve/bin/python manage.py celery worker
fi
if [ "$1" == "beat" ]; then
exec /ve/bin/python manage.py celery beat
fi
# run arbitrary commands
if [ "$1" == "manage" ]; then
shift
exec /ve/bin/python manage.py "$@"
fi
if [ "$1" == "run" ]; then
exec /ve/bin/gunicorn --env \
DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE \
$APP.wsgi:application -b 0.0.0.0:8000 -w 3 \
-t 600 \
--access-logfile=- --error-logfile=-
fi