FROM python:3.13-slim
WORKDIR /app
ENV OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 PYTHONDONTWRITEBYTECODE=1 MPLCONFIGDIR=/tmp/matplotlib
COPY requirements-runtime.txt ./
RUN pip install --no-cache-dir -r requirements-runtime.txt && useradd --uid 10001 --create-home researcher
COPY app.py geometry.py model.py metrics.py upload.py local_cases.py cloud_api.py storage.py dose_export.py ./
COPY static ./static
COPY artifacts/model.joblib artifacts/model_card.json artifacts/resolution_check.json ./artifacts/
USER researcher
EXPOSE 8000
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--no-access-log", "--limit-concurrency", "8"]
