20 lines
483 B
Bash
Executable File
20 lines
483 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
ROLE="${ROLE:-web}"
|
|
|
|
if [[ "$ROLE" == "web" ]]; then
|
|
echo "[entrypoint] waiting for database..."
|
|
python manage.py wait_for_db --timeout 60 || true
|
|
|
|
echo "[entrypoint] running migrations..."
|
|
python manage.py migrate --noinput
|
|
|
|
if [[ "${DJANGO_DEBUG:-False}" != "True" ]]; then
|
|
echo "[entrypoint] collecting static files..."
|
|
python manage.py collectstatic --noinput --clear
|
|
fi
|
|
fi
|
|
|
|
echo "[entrypoint] starting role=$ROLE: $*"
|
|
exec "$@"
|