aboutsummaryrefslogtreecommitdiff
path: root/ci-amd64-llp-alpine/docker_run.sh
blob: 43ab62d62b58db0a39c59363406c304369de2f97 (plain)
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
#!/bin/sh -e

# if DJANGO_DEBUG is defined, we'll run via django with dynamic reloading of
# code changes to disk. This is helpful for debugging something already in k8s

if [ -z "$DJANGO_DEBUG" ] ; then
    # Double quotes are important, otherwise docker strips the newlines
    # These are set as a env in our playbook
    echo "$secrets_file" >> /srv/secrets.py
    echo "$allowed_hosts" >> /srv/allowed_hosts.txt
    if [ ! -z "$html_header" ] ; then
        echo "$html_header" >> /srv/header_override.html
    fi

    if [ ! -z "$DJANGO_MIGRATE" ]; then
        python $APPDIR/manage.py migrate --noinput
    fi
    if [ ! -z "$DJANGO_COLLECTSTATIC" ]; then
        python $APPDIR/manage.py collectstatic --noinput
    fi

    exec /usr/bin/gunicorn -w4 -b 0.0.0.0:$PORT $LLP_APP
fi

exec python $APPDIR/manage.py runserver