| # Multi-stage build for production | |
| FROM node:22-bookworm AS frontend | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm ci | |
| COPY frontend/ . | |
| RUN npm run build | |
| FROM python:3.12-slim AS backend | |
| WORKDIR /app | |
| COPY backend/requirements.txt ./backend/ | |
| RUN pip install --no-cache-dir -r backend/requirements.txt | |
| COPY backend/ ./backend | |
| COPY --from=frontend /app/frontend/out ./frontend/out | |
| # Optional: serve frontend via FastAPI static or nginx | |
| EXPOSE 8000 | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--app-dir", "backend"] | |