FROM mcr.microsoft.com/playwright/python:v1.49.0-jammy WORKDIR /code COPY requirements.txt . RUN pip install --no-cache-dir --upgrade -r requirements.txt RUN playwright install chromium COPY . . RUN chmod -R 777 /code EXPOSE 7860 # --- GOLDEN SETTING FOR STABILITY --- # workers=1, threads=1 means NO CRASHES. CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--workers", "1", "--threads", "1", "--worker-class", "sync", "--timeout", "120"]