Spaces:
Running

axeronis commited on
Commit
6d711fe
·
1 Parent(s): 9ad9fa2

fix(docker): use CPU-only PyTorch to reduce image size from 7.5GB to ~3GB

Browse files
Files changed (1) hide show
  1. chatterbox-service/Dockerfile +12 -3
chatterbox-service/Dockerfile CHANGED
@@ -6,16 +6,25 @@ WORKDIR /app
6
  RUN apt-get update && apt-get install -y \
7
  ffmpeg \
8
  git \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Install Python dependencies
 
 
 
 
 
 
12
  RUN pip install --no-cache-dir \
13
  fastapi \
14
  uvicorn \
15
- chatterbox-tts \
16
  pydub \
17
  python-multipart
18
 
 
 
 
19
  # Copy application
20
  COPY . .
21
 
@@ -23,7 +32,7 @@ COPY . .
23
  EXPOSE 8001
24
 
25
  # Health check
26
- HEALTHCHECK --interval=30s --timeout=10s --start-period=60s \
27
  CMD curl -f http://localhost:8001/health || exit 1
28
 
29
  # Run server
 
6
  RUN apt-get update && apt-get install -y \
7
  ffmpeg \
8
  git \
9
+ curl \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Install CPU-only PyTorch first (smaller)
13
+ RUN pip install --no-cache-dir \
14
+ torch==2.1.0+cpu \
15
+ torchaudio==2.1.0+cpu \
16
+ -f https://download.pytorch.org/whl/cpu/torch_stable.html
17
+
18
+ # Install other dependencies
19
  RUN pip install --no-cache-dir \
20
  fastapi \
21
  uvicorn \
 
22
  pydub \
23
  python-multipart
24
 
25
+ # Install chatterbox without dependencies (we installed torch manually)
26
+ RUN pip install --no-cache-dir --no-deps chatterbox-tts
27
+
28
  # Copy application
29
  COPY . .
30
 
 
32
  EXPOSE 8001
33
 
34
  # Health check
35
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=120s \
36
  CMD curl -f http://localhost:8001/health || exit 1
37
 
38
  # Run server