File size: 1,997 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
version: '3.8'

services:
  # Main API Service (always included)
  chatterbox-tts:
    build:
      context: ..
      dockerfile: docker/Dockerfile.cpu
    container_name: chatterbox-tts-api-cpu
    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=cpu # Force CPU for this variant
      - MODEL_CACHE_DIR=/cache

      # Memory Settings
      - MEMORY_CLEANUP_INTERVAL=${MEMORY_CLEANUP_INTERVAL:-5}
      - CUDA_CACHE_CLEAR_INTERVAL=${CUDA_CACHE_CLEAR_INTERVAL:-3}
      - ENABLE_MEMORY_MONITORING=${ENABLE_MEMORY_MONITORING:-true}

    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

    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