umap/docker-entrypoint.sh
Nikita Klyshko 0cffe1e174
Closes #1: Add docker environment for development and production (#12)
* Added docker support

* Remove erroring line for man

* Requirements.txt has been removed

* Prevent not displaying error

* Use latest Node JS LTS

* Removed suspended phantomjs and allows for arm64

* Copy statement didn't work in build container

* Install tini with package manager to allow arm64

* Closes #1: Add docker environment for development and production

* Fix

---------

Co-authored-by: Remco Schoen <remco@dieselwalm.nl>
2023-04-15 16:04:21 +03:00

35 lines
807 B
Bash
Executable file

#!/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
)}
# 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
if [ "$PYTHON_DEBUG" = true ] ; then
python -m debugpy --listen 0.0.0.0:5678 manage.py runserver 0.0.0.0:8000 --nothreading --noreload
else
exec uwsgi --ini uwsgi.ini
fi