File size: 2,145 Bytes
36e2bdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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