Files
delphi-database/DOCKER_USAGE.md
HotSwapp 16d7455f85 fix: Clean up Docker configuration and resolve build issues
- 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.
2025-09-04 17:54:57 -05:00

80 lines
2.3 KiB
Markdown

# Docker Usage Guide
## Quick Start
### Development Environment
```bash
# 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
```bash
# 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-reload
- `delphi-database:latest` - Production image optimized for performance
- `delphi-database:<version>` - Tagged production image with version
## Environment Variables
### Required for Production
- `SECRET_KEY` - JWT secret key (generate with `openssl 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
1. Check if port 6920 is already in use
2. Ensure required environment variables are set
3. Check Docker logs: `docker-compose logs`
### Database issues
1. Check database file permissions in `./data` directory
2. Ensure the container can write to mounted volumes
3. Check initialization logs for admin user creation
### Build failures
1. Ensure Docker daemon is running
2. Clear Docker cache: `docker system prune -f`
3. Rebuild without cache: `docker-compose build --no-cache`