version: '3.8' services: # Main API Service (always included) chatterbox-tts: build: context: .. dockerfile: docker/Dockerfile.gpu container_name: chatterbox-tts-api-gpu ports: - '${PORT:-4123}:${PORT:-4123}' environment: # API Configuration - PORT=${PORT:-4123} - HOST=${HOST:-0.0.0.0} # TTS Model Settings - EXAGGERATION=${EXAGGERATION:-0.5} - CFG_WEIGHT=${CFG_WEIGHT:-0.5} - TEMPERATURE=${TEMPERATURE:-0.8} # Text Processing - MAX_CHUNK_LENGTH=${MAX_CHUNK_LENGTH:-280} - MAX_TOTAL_LENGTH=${MAX_TOTAL_LENGTH:-3000} # Voice and Model Settings - VOICE_SAMPLE_PATH=/app/voice-sample.mp3 - DEVICE=${DEVICE:-cuda} - MODEL_CACHE_DIR=/cache # NVIDIA/CUDA settings - NVIDIA_VISIBLE_DEVICES=all - NVIDIA_DRIVER_CAPABILITIES=compute,utility volumes: # Mount voice sample file (optional) - ${VOICE_SAMPLE_HOST_PATH:-../voice-sample.mp3}:/app/voice-sample.mp3:ro # Mount model cache for persistence - chatterbox-models:/cache # Optional: Mount custom voice samples directory - ${VOICE_SAMPLES_DIR:-../voice-samples}:/app/voice-samples:ro # GPU support (Docker Compose v2 format) deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu] # Alternative GPU support (older format) # runtime: nvidia restart: unless-stopped healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:${PORT:-4123}/health'] interval: 30s timeout: 10s retries: 3 start_period: 300s # Frontend Service with integrated proxy (optional - requires 'frontend' profile) frontend: profiles: ['frontend', 'ui', 'fullstack'] build: context: ../frontend dockerfile: Dockerfile container_name: chatterbox-tts-frontend ports: - '${FRONTEND_PORT:-4321}:80' # Frontend serves on port 80 internally depends_on: - chatterbox-tts restart: unless-stopped volumes: chatterbox-models: driver: local