FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . # Create necessary directories RUN mkdir -p /app/images /app/videos # Environment variables ENV PYTHONUNBUFFERED=1 ENV FLASK_ENV=production ENV FLASK_APP=app.py # Use gthread worker for better performance CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--worker-class", "gthread", "--workers", "1", "--threads", "4", "--timeout", "0", "app:app"]