FROM python:3.11-slim # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /code # Install python requirements COPY requirements.txt /code/requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy download script and pre-cache models inside image COPY download_models.py /code/download_models.py RUN python3 /code/download_models.py # Copy application source COPY . /code # Change permissions to run under non-root user in HF Spaces RUN chmod -R 777 /code # Expose default port EXPOSE 7860 # Run FastAPI app CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]