| # Use Node.js image for frontend | |
| FROM node:20-slim AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install --legacy-peer-deps | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Use Python image with uv pre-installed | |
| FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim | |
| # Set up Node.js and npm | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | |
| && apt-get install -y nodejs | |
| WORKDIR /app | |
| # Copy backend code | |
| COPY backend/ backend/ | |
| COPY pyproject.toml . | |
| RUN uv sync && uv pip install . | |
| ENV PATH="/app/.venv/bin:/root/.local/bin:/root/.uv/venv/bin:${PATH}" | |
| # Copy frontend from builder | |
| COPY --from=frontend-builder /app/frontend /app/frontend | |
| COPY --from=frontend-builder /app/frontend/build /app/static |