TTS_API / Dockerfile
khurrameycon's picture
Update Dockerfile
c9ee0f1 verified
raw
history blame
1.06 kB
FROM python:3.9-slim
# 1. Install system dependencies
RUN apt-get update && apt-get install -y \
espeak-ng \
libsndfile1 \
git
# 2. Configure environment
ENV HF_HOME=/app/cache \
XDG_CACHE_HOME=/app/cache \
PYTHONPATH="${PYTHONPATH}:/app"
# 3. Create all required directories with proper permissions
RUN mkdir -p /app/cache/hub/models--hexgrad--Kokoro-82M && \
mkdir -p /app/cache/hub/.locks/models--hexgrad--Kokoro-82M && \
chmod -R 777 /app && \
chmod -R 777 /app/cache/hub/.locks
WORKDIR /app
# 4. Install Python dependencies
COPY requirements.txt .
# First install setup tools
RUN pip install --upgrade pip setuptools wheel
# Then install other requirements
RUN pip install --no-cache-dir -r requirements.txt
# Pre-download the model with explicit permissions
RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download('hexgrad/Kokoro-82M', 'config.json')" || true && \
chmod -R 777 /app/cache
# 5. Copy application code
COPY . .
# 6. Run FastAPI
CMD uvicorn app:app --host 0.0.0.0 --port 7860