FROM python:3.13-slim AS build
WORKDIR /build
COPY requirements.txt .
RUN python -m pip wheel --wheel-dir /wheels -r requirements.txt
FROM python:3.13-slim
RUN groupadd --gid 10001 kdc && useradd --uid 10001 --gid 10001 --no-create-home kdc
WORKDIR /app
COPY --from=build /wheels /wheels
COPY requirements.txt .
RUN python -m pip install --no-cache-dir --no-index --find-links=/wheels -r requirements.txt && rm -rf /wheels
COPY app.py migrate.py ./
USER 10001:10001
EXPOSE 8081
CMD ["gunicorn", "--bind", "0.0.0.0:8081", "--workers", "1", "--access-logfile", "-", "--graceful-timeout", "20", "app:app"]
