# m2-market-web — FastAPI proxy + React SPA in one container (specs/002-market-web). # Build context: repo root (needs web/backend + web/frontend). FROM node:20-slim AS frontend WORKDIR /fe COPY web/frontend/package.json web/frontend/package-lock.json* ./ RUN npm install --no-audit --no-fund COPY web/frontend/ ./ RUN npm run build FROM python:3.12-slim WORKDIR /app COPY web/backend/pyproject.toml ./backend/pyproject.toml COPY web/backend/src ./backend/src RUN pip install --no-cache-dir ./backend COPY --from=frontend /fe/dist ./frontend/dist ENV M2MW_STATIC_DIR=/app/frontend/dist RUN groupadd --system web && useradd --system --gid web web USER web EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)" || exit 1 CMD ["uvicorn", "m2_market_web.main:app", "--host", "0.0.0.0", "--port", "8000"]