- Fix Windows line endings (CRLF) in docker-build.sh script - Remove deprecated 'version' field from docker-compose.dev.yml - Standardize database URL paths across compose files - Optimize Dockerfile.production with better pip upgrade handling - Improve health check timings for better container startup - Add comprehensive Docker usage documentation - Ensure all Docker files use consistent formatting and best practices All Docker builds now work correctly and containers start successfully.
2.3 KiB
2.3 KiB
Docker Usage Guide
Quick Start
Development Environment
# Build and start development container
docker-compose -f docker-compose.dev.yml up --build
# Or use the build script
./docker-build.sh
docker-compose -f docker-compose.dev.yml up
Production Environment
# Build and start production container
docker-compose up --build
# Or use the build script
./docker-build.sh
docker-compose up
Available Images
delphi-database:dev- Development image with source code mounting and auto-reloaddelphi-database:latest- Production image optimized for performancedelphi-database:<version>- Tagged production image with version
Environment Variables
Required for Production
SECRET_KEY- JWT secret key (generate withopenssl rand -base64 32)ADMIN_PASSWORD- Initial admin user password
Optional Configuration
DATABASE_URL- Database connection string (default: sqlite:///app/data/delphi_database.db)DEBUG- Enable debug mode (default: False for production, True for development)EXTERNAL_PORT- External port mapping (default: 6920)WORKERS- Number of Gunicorn workers (default: 4)LOG_LEVEL- Logging level (default: INFO for production, DEBUG for development)
Container Access
The application runs on port 8000 inside the container and is mapped to port 6920 on the host by default.
- Application: http://localhost:6920
- Health check: http://localhost:6920/health
Data Persistence
Development
- Source code: Mounted from host for live reload
- Database: Docker volume
delphi_dev_data - Uploads: Docker volume
delphi_dev_uploads - Backups: Docker volume
delphi_dev_backups
Production
- Database: Host directory
./data(for easy backup) - Uploads: Docker volume
delphi_uploads - Backups: Docker volume
delphi_backups
Troubleshooting
Container won't start
- Check if port 6920 is already in use
- Ensure required environment variables are set
- Check Docker logs:
docker-compose logs
Database issues
- Check database file permissions in
./datadirectory - Ensure the container can write to mounted volumes
- Check initialization logs for admin user creation
Build failures
- Ensure Docker daemon is running
- Clear Docker cache:
docker system prune -f - Rebuild without cache:
docker-compose build --no-cache