FROM python:3.12-slim WORKDIR /app RUN addgroup --system app && adduser --system --group app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt && \ rm -rf /root/.cache/pip COPY . . USER app EXPOSE 7860 ENV FLASK_ENV=production \ PORT=7860 \ HOST=0.0.0.0 \ LOG_LEVEL=INFO \ PYTHONUNBUFFERED=1 CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--timeout", "300", "--access-logfile", "-", "--error-logfile", "-", "webapp:app"]