#!/bin/bash echo "Waiting for PostgreSQL..." sleep 5 echo "Running migrations..." python manage.py migrate --noinput || { echo "Migration failed!" exit 1 } echo "Creating default groups..." python manage.py create_groups || { echo "Group creation failed!" exit 1 } echo "Setting up social applications..." python manage.py setup_social_apps || { echo "Social apps setup failed!" exit 1 } echo "Building Tailwind CSS..." # Ensure Tailwind dependencies are installed and build production CSS python manage.py tailwind install || true python manage.py tailwind build || echo "Warning: Tailwind build failed; continuing to collect static files" echo "Collecting static files..." # Handle potential permission issues with Docker volumes # Try to collect static files, but don't fail if it doesn't work since we have build-time static files set +e python manage.py collectstatic --noinput --clear 2>/dev/null if [ $? -eq 0 ]; then echo "✅ Static files collected successfully!" else echo "⚠️ Static file collection failed due to permission issues." echo "This is common with Docker volume mounts on deployment platforms." echo "The application will use static files collected during the Docker build." echo "Your app will work normally with build-time static files." fi # Re-enable exit-on-error for the rest of the script set -e echo "Starting application..." exec "$@"