FROM python:3.10-slim # ── System deps ──────────────────────────────────────────────────────────────── RUN apt-get update && apt-get install -y \ ffmpeg git curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # ── Upgrade pip + fix typing-extensions before torch ────────────────────────── RUN pip install --no-cache-dir --upgrade pip "typing-extensions>=4.10.0" # ── PyTorch CPU (needed by faster-whisper / transformers) ───────────────────── RUN pip install --no-cache-dir "torch>=2.6.0" torchaudio \ --index-url https://download.pytorch.org/whl/cpu # ── Core app deps ────────────────────────────────────────────────────────────── RUN pip install --no-cache-dir \ fastapi uvicorn \ requests httpx \ python-multipart aiofiles \ groq \ deep-translator transformers tokenizers \ huggingface_hub sentencepiece sacremoses \ soundfile numpy \ librosa ffmpeg-python faster-whisper \ cloudinary \ cleanvoice-sdk COPY . . # ── Fix cache dir permissions before switching user ──────────────────────────── RUN mkdir -p /app/.cache/huggingface && chown -R 1000:1000 /app RUN useradd -m -u 1000 user USER user ENV HF_HOME=/app/.cache/huggingface ENV TRANSFORMERS_CACHE=/app/.cache/huggingface ENV HOME=/home/user EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]