| # Use an updated, secure Python image | |
| FROM python:3.10-slim-bullseye | |
| # Prevent interactive prompts during package installs | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # 1. Install FFmpeg and any essential system dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends ffmpeg && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # 2. Set working directory | |
| WORKDIR /app | |
| # 3. Copy requirements first (better caching) | |
| COPY requirements.txt /app/requirements.txt | |
| # 4. Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy your Flask application file | |
| COPY app.py /app/ | |
| # 6. Expose the port | |
| EXPOSE 7860 | |
| # 7. Command to run your app via Gunicorn | |
| CMD exec gunicorn --bind 0.0.0.0:7860 --workers 2 app:ffmpeg_app | |