Kokoro-tts-API / Dockerfile
Novachrono93's picture
Create Dockerfile
34a5494 verified
# 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"]