- Add CSRF_TRUSTED_ORIGINS setting to read from environment variable
- Update docker-compose.dokploy.yml with correct domain dt.netcoptech.com
- Update dokploy.json with proper domain configuration
- Fix 500 error by supporting CSRF trusted origins for production domains
- 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.
## Problem Analysis:
- Static files collection failing with permission errors in Docker containers
- Non-root user cannot create directories in container filesystem
- Previous fix didn't handle runtime permission management properly
## Comprehensive Solution:
### 1. Enhanced Dockerfile:
- Added `gosu` package for secure user switching
- Removed premature USER directive - run setup as root first
- Improved directory permissions with proper chmod/chown
### 2. Robust Entrypoint Script:
- Runs initial setup (migrations, static collection) as root
- Explicitly sets directory permissions for static/media files
- Uses `gosu` to securely switch to django user for main application
- Ensures proper ownership before application starts
### 3. Updated Docker Compose Volume:
- Changed volume mapping to use ../files/staticfiles (more descriptive)
- Ensures persistent storage for static files across deployments
## Security & Best Practices:
- ✅ Maintains security with non-root application runtime
- ✅ Handles setup operations with necessary root permissions
- ✅ Uses gosu for secure user switching (better than su/sudo)
- ✅ Explicit permission management for container directories
## Benefits:
- Resolves all static files permission errors
- Works reliably in containerized environments
- Maintains security best practices
- Compatible with Dokploy and other orchestration platforms
This should completely resolve the collectstatic permission issues.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
## New Files Added:
- **docker-compose.dokploy.yml** - Dokploy-optimized compose file with:
- dokploy-network integration for all services
- Traefik labels for SSL and domain routing
- Persistent volumes using ../files/ directory
- Production-ready Django, PostgreSQL, and Redis configuration
- **DOKPLOY.md** - Complete step-by-step deployment guide including:
- 10-step deployment process with exact form fields
- Domain configuration and DNS setup
- Environment variables for production
- Post-deployment Django setup commands
- Comprehensive troubleshooting section
- Production checklist and monitoring guidance
## Key Features:
- **Production-ready** configuration with SSL certificates
- **Persistent data** storage across deployments
- **Detailed troubleshooting** for common issues
- **Copy-paste configurations** for immediate use
- **Security best practices** implemented
This enables one-click deployment of the Django template on any Dokploy server with professional-grade configuration.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>