# Stage 1 — build the SPA. FROM node:22-alpine AS web WORKDIR /web COPY web/package.json web/package-lock.json ./ RUN npm ci COPY web/ ./ RUN npm run build # Stage 2 — the server, with the built bundle baked in. FROM python:3.12-slim WORKDIR /app COPY server/requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt COPY server/ ./ COPY --from=web /web/dist ./web/dist ENV WEB_DIST=/app/web/dist # Run as an unprivileged user (container must not run as root). RUN useradd --create-home --uid 10001 appuser \ && chown -R appuser:appuser /app USER appuser EXPOSE 8000 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]