Docker Deployment
Docker Deployment
Section titled “Docker Deployment”Deploy Subtide backend using Docker.
Quick Start
Section titled “Quick Start”cd backenddocker-compose up subtide-tier2The backend will be available at http://localhost:5001.
Docker Compose Services
Section titled “Docker Compose Services”Tier 1: Standard
Section titled “Tier 1: Standard”YouTube captions only, no transcription:
docker-compose up subtide-tier1Use when:
- Videos have existing captions
- You want minimal resource usage
- Browser provides the API key
Tier 2: Enhanced
Section titled “Tier 2: Enhanced”Full Whisper transcription support:
docker-compose up subtide-tier2Use when:
- You need transcription for any video
- Browser provides the API key
- Most common choice
Tier 3: Managed
Section titled “Tier 3: Managed”Server-side API key:
SERVER_API_KEY=sk-xxx \SERVER_API_URL=https://api.openai.com/v1 \SERVER_MODEL=gpt-4o \docker-compose up subtide-tier3Use when:
- Deploying for a team
- Centralizing API key management
- Hiding API key from clients
Tier 4: Streaming
Section titled “Tier 4: Streaming”Real-time progressive translation:
SERVER_API_KEY=sk-xxx \SERVER_API_URL=https://api.openai.com/v1 \SERVER_MODEL=gpt-4o \docker-compose up subtide-tier4Use when:
- You want subtitles as they’re generated
- Lowest perceived latency
- Server handles everything
Building Images
Section titled “Building Images”Build Locally
Section titled “Build Locally”cd backenddocker build -t subtide-backend .Using Pre-built Images
Section titled “Using Pre-built Images”# Standard backenddocker pull ghcr.io/rennerdo30/subtide-backend:latest
# RunPod variantdocker pull ghcr.io/rennerdo30/subtide-runpod:latestEnvironment Variables
Section titled “Environment Variables”Pass environment variables to configure the container:
docker run -d \ -p 5001:5001 \ -e WHISPER_MODEL=large-v3-turbo \ -e WHISPER_BACKEND=faster \ -e CORS_ORIGINS="*" \ ghcr.io/rennerdo30/subtide-backend:latestAvailable Variables
Section titled “Available Variables”| Variable | Description | Default |
|---|---|---|
PORT | Internal port | 5001 |
GUNICORN_WORKERS | Worker processes | 2 |
GUNICORN_TIMEOUT | Request timeout (s) | 300 |
CORS_ORIGINS | CORS allowed origins | * |
WHISPER_MODEL | Whisper model size | base |
WHISPER_BACKEND | mlx, faster, openai | Auto |
SERVER_API_KEY | API key (Tier 3/4) | — |
SERVER_API_URL | LLM endpoint (Tier 3/4) | — |
SERVER_MODEL | LLM model (Tier 3/4) | — |
Volume Mounts
Section titled “Volume Mounts”Model Cache
Section titled “Model Cache”Persist downloaded Whisper models:
docker run -d \ -p 5001:5001 \ -v ~/.cache/whisper:/root/.cache/whisper \ ghcr.io/rennerdo30/subtide-backend:latestCustom Configuration
Section titled “Custom Configuration”Mount a custom .env file:
docker run -d \ -p 5001:5001 \ -v /path/to/.env:/app/.env \ ghcr.io/rennerdo30/subtide-backend:latestGPU Support
Section titled “GPU Support”NVIDIA GPU
Section titled “NVIDIA GPU”Use the NVIDIA Container Toolkit:
docker run -d \ --gpus all \ -p 5001:5001 \ -e WHISPER_BACKEND=faster \ ghcr.io/rennerdo30/subtide-backend:latestRequires:
- NVIDIA GPU with CUDA support
- NVIDIA Container Toolkit installed
Docker Compose Reference
Section titled “Docker Compose Reference”Full docker-compose.yml Example
Section titled “Full docker-compose.yml Example”version: '3.8'
services: subtide: image: ghcr.io/rennerdo30/subtide-backend:latest ports: - "5001:5001" environment: - WHISPER_MODEL=large-v3-turbo - WHISPER_BACKEND=faster - CORS_ORIGINS=* - GUNICORN_WORKERS=4 - GUNICORN_TIMEOUT=600 volumes: - whisper-cache:/root/.cache/whisper deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu]
volumes: whisper-cache:Health Checks
Section titled “Health Checks”Docker health check is built-in:
docker ps# Check HEALTH column
docker inspect --format='{{.State.Health.Status}}' <container>Manual check:
curl http://localhost:5001/healthTroubleshooting
Section titled “Troubleshooting”Container exits immediately
Section titled “Container exits immediately”Check logs:
docker logs <container_id>Common causes:
- Port already in use
- Missing environment variables
- Insufficient memory
Out of memory
Section titled “Out of memory”Increase Docker memory limit or use a smaller model:
-e WHISPER_MODEL=basePermission denied
Section titled “Permission denied”On Linux, add your user to the docker group:
sudo usermod -aG docker $USERProduction Considerations
Section titled “Production Considerations”- Use specific tags instead of
latest - Set resource limits for memory and CPU
- Configure logging with log drivers
- Use secrets for API keys instead of environment variables
- Set up health checks for orchestration
Next Steps
Section titled “Next Steps”- RunPod Deployment - Cloud GPU deployment
- API Reference - API documentation