1
0
docker-umap/docker-entrypoint.sh

34 lines
717 B
Bash
Raw Normal View History

2022-11-18 16:06:31 +01:00
#!/usr/bin/env bash
set -eo pipefail
# default variables
: "${SLEEP:=1}"
: "${TRIES:=60}"
function wait_for_database {(
echo "Waiting for database to respond..."
tries=0
while true; do
[[ $tries -lt $TRIES ]] || return
(echo "from django.db import connection; connection.connect()" | umap shell) >/dev/null
[[ $? -eq 0 ]] && return
sleep $SLEEP
tries=$((tries + 1))
done
)}
source /srv/umap/venv/bin/activate
# first wait for the database
wait_for_database
# then migrate the database
umap migrate
# then collect static files
umap collectstatic --noinput
# create languagae files
#umap storagei18n
# compress static files
umap compress
# run uWSGI
exec uwsgi --ini /srv/umap/uwsgi.ini