FROM python:3.10-slim WORKDIR /app COPY . /app/ RUN pip install --no-cache-dir -r requirements.txt # Install system dependencies including ffmpeg # Make sure this runs as root before potentially switching to a non-root user RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Create entrypoint script directly RUN echo '#!/bin/sh\n\n# Start the FastAPI application\nuvicorn app:app --host 0.0.0.0 --port 7860' > /app/entrypoint.sh RUN chmod +x /app/entrypoint.sh # Ensure cookies.txt is copied and readable COPY cookies.txt /app/cookies.txt RUN chmod a+r /app/cookies.txt EXPOSE 7860 ENV PYTHONUNBUFFERED=1 ENV DEPLOYMENT_ENV=huggingface USER root # Use entrypoint script to handle startup ENTRYPOINT ["/app/entrypoint.sh"]