| # Use a slim Python image for a smaller footprint | |
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 | |
| # Install system dependencies (ffmpeg is essential) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| git \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Create the output directories and give permissions | |
| RUN mkdir -p clips_short clips_long && chmod 777 -R /app | |
| # Expose the Gradio port | |
| EXPOSE 7860 | |
| # Run the application | |
| # server_name 0.0.0.0 is already in your app.py, so we just call it | |
| CMD ["python", "app.py"] | |