# Start with a lightweight Python image FROM python:3.9-slim # Install FFmpeg (Required for MoviePy/Video processing) RUN apt-get update && \ apt-get install -y ffmpeg && \ rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Create necessary directories and set permissions so the app can write to them RUN mkdir -p uploads user_files && \ chmod 777 uploads user_files # Copy the rest of the app code COPY . . # Expose the standard Hugging Face port EXPOSE 7860 # Run the app with Gunicorn for stability CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--timeout", "300"]