FROM python:3.11-slim WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app COPY . . # Init DB on build RUN python -c "from app import init_db; init_db()" EXPOSE 7860 # 1 worker for SQLite safety, 8 threads for concurrency, long timeout for streaming CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "8", "--timeout", "300", "app:app"]