# Stage 1: build the React SPA FROM node:22-alpine AS frontend WORKDIR /fe COPY frontend/package.json frontend/package-lock.json ./ # npm ci: install exactly the committed lockfile — a fresh resolve against the # registry is neither reproducible nor reliable (arborist crashed on 2026-09-17). RUN npm ci --no-audit --no-fund COPY frontend/ ./ RUN npm run build # Stage 2: Python runtime FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # poppler-utils: pdftoppm for medical-record PDF -> image extraction RUN apt-get update && apt-get install -y --no-install-recommends poppler-utils && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY server ./server COPY --from=frontend /fe/dist ./frontend/dist ENV FRONTEND_DIST=/app/frontend/dist EXPOSE 8000 CMD ["uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers"]