File size: 1,065 Bytes
34a5494
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use lightweight Python
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# 1. Install System Dependencies
# We install 'espeak-ng' which contains the voice dictionaries
RUN apt-get update && apt-get install -y \
    espeak-ng \
    wget \
    && rm -rf /var/lib/apt/lists/*

# 2. CRITICAL: Tell Python where the library is on Linux
# This specific path works for Hugging Face Spaces (Debian)
ENV PHONEMIZER_ESPEAK_LIBRARY="/usr/lib/x86_64-linux-gnu/libespeak-ng.so.1"

# 3. Install Python Libraries
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 4. Download Model Files (int8 for CPU speed)
RUN wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.int8.onnx
RUN wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin

# 5. Copy App Code & Fix Permissions
COPY app.py .
RUN chmod -R 777 /app

# 6. Run Server (Timeout set to 120s to prevent 503 errors during load)
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--timeout", "120"]