FROM python:3.10-slim # Install system dependencies (including ffmpeg) RUN apt-get update && apt-get install -y \ ffmpeg \ && rm -rf /var/lib/apt/lists/* # Set up a new user to avoid running as root RUN useradd -m -u 1000 user WORKDIR /home/user/app # Copy requirements and install dependencies COPY --chown=user:user requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application files COPY --chown=user:user . . # Expose the port Hugging Face expects EXPOSE 7860 # Run the FastAPI application using Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]