# Use Python 3.9 Slim (Faster build) FROM python:3.9-slim # 1. Install system dependencies (as root) RUN apt-get update && \ apt-get install -y ffmpeg wget && \ rm -rf /var/lib/apt/lists/* # 2. Setup User 1000 (Required by Hugging Face) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # 3. Set Working Directory WORKDIR $HOME/app # 4. Install Python Dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt # 5. Copy App Code COPY --chown=user app.py . # 6. Run CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]