#!/bin/bash set -e echo "--> Production Initialization Starting..." # 1. Install Tailwind Node internal packages if they are missing echo "--> Initializing Tailwind dependencies..." python manage.py tailwind install --no-input || echo "Tailwind install skipped or not required" # 2. Compile Tailwind styles into minified production files echo "--> Compiling Tailwind production CSS layouts..." python manage.py tailwind build --no-input || echo "Tailwind build skipped" # 3. Collect all static assets (Django Admin UI, Theme, third-party packages) echo "--> Collecting static configuration assets..." python manage.py collectstatic --noinput # 4. Process PostgreSQL database schemas and structural migrations echo "--> Applying database migrations..." python manage.py migrate --noinput # 5. Execute Gunicorn web app process echo "--> Launching Gunicorn engine on port $PORT..." exec gunicorn config.wsgi:application --bind 0.0.0.0:$PORT --workers 3 --timeout 120