This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
idhub-docker/docker/orchestra.entrypoint.sh

31 lines
746 B
Bash
Raw Normal View History

#!/bin/sh
set -e
set -u
#set -x
_subs() {
key="${1}"
value="${2}"
file="${3}"
sed -i "s/^\(${key} =\).*/\1 '${value}'/" "${file}"
}
# go to the same path as the script
cd "$(dirname ${0})"
SECRET_KEY=${SECRET_KEY}
ALLOWED_HOSTS=${ALLOWED_HOSTS:-*}
# override settings with env vars defined in docker
settings_file='panel/settings.py'
_subs 'ALLOWED_HOSTS' "${ALLOWED_HOSTS}" "${settings_file}"
_subs 'SECRET_KEY' "${SECRET_KEY}" "${settings_file}"
# move the migrate thing in docker entrypoint
# inspired by https://medium.com/analytics-vidhya/django-with-docker-and-docker-compose-python-part-2-8415976470cc
#python3 manage.py migrate
expect -f ./orchestra.migrate.exp
./manage.py runserver 0.0.0.0:9080