mirror of
https://github.com/thecyberlearn/modern-django-starter.git
synced 2026-08-18 07:52:54 +00:00
- Add build-time static file collection to handle Docker volume permission issues - Create django_project/settings/build.py for minimal build-time settings - Enhance entrypoint.sh with graceful fallback when collectstatic fails - Improve Dockerfile permissions and add Tailwind build during Docker build - Add WARP.md with comprehensive development guidance - Include test-docker-build.sh script for local testing - Update docker-compose.dokploy.yml with build optimizations Fixes permission denied errors during static file collection on Dokploy deployments.
48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/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 "$@"
|