Files
penracourses/entrypoint.sh
T
2025-12-01 10:36:58 +00:00

26 lines
662 B
Bash

#!/bin/sh
set -e
# Lightweight wait-for-postgres using nc (expects DATABASE_HOST and DATABASE_PORT env vars)
if [ -n "${DATABASE_HOST}" ]; then
host="$DATABASE_HOST"
port="${DATABASE_PORT:-5432}"
echo "Waiting for database at ${host}:${port}..."
while ! nc -z "$host" "$port"; do
sleep 1
done
fi
echo "Applying database migrations..."
python manage.py migrate --noinput
echo "Collecting static files..."
python manage.py collectstatic --noinput
echo "Starting gunicorn..."
exec gunicorn rad.wsgi:application \
--name rad_gunicorn \
--bind 0.0.0.0:8000 \
--workers ${GUNICORN_WORKERS:-3} \
--log-level ${GUNICORN_LOGLEVEL:-info}