# Use a modern Python base FROM python:3.10-slim # Set working directory WORKDIR /app # Copy dependency list first (cache layer) COPY requirements.txt ./ # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Expose the default port ENV PORT=7860 EXPOSE 7860 # Use gunicorn for production; keep one worker with threads (adjust workers for your need) CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "60", "--worker-class", "gthread", "app:app"]