FROM python:3.11-slim WORKDIR /app # Install CPU-only torch first (saves ~1.8GB vs CUDA build) RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . COPY download_models.py . # Pre-download commonly used TTS models so first requests are fast. RUN python download_models.py EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]