tandoor/entrypoint.sh
2025-03-22 12:23:18 +01:00

23 lines
No EOL
576 B
Bash

#!/bin/sh
# Check for required environment variables
if [ -z "$DB_HOST" ] || [ -z "$DB_PORT" ] || [ -z "$SECRET_KEY" ]; then
echo "Error: Required environment variables not set!"
exit 1
fi
# Wait for PostgreSQL to be available
echo "Waiting for PostgreSQL..."
while ! nc -z $DB_HOST $DB_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
# Run database migrations using virtual environment
su-exec tandoor /venv/bin/python manage.py migrate
# Collect static files
su-exec tandoor /venv/bin/python manage.py collectstatic --noinput
# Start application
exec "$@"