Spaces:
Running
Running
| # --- Build Stage for Frontend --- | |
| FROM node:20-alpine AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json frontend/package-lock.json* ./ | |
| RUN npm ci || npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # --- Build Stage for Backend --- | |
| FROM python:3.13-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Use the official uv binary | |
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /uv/bin/uv | |
| ENV PATH="/uv/bin:$PATH" | |
| COPY backend/ ./backend/ | |
| RUN cd backend && uv pip install --system . --no-cache-dir | |
| # Copy backend code | |
| COPY backend/ ./backend/ | |
| RUN cd backend && uv pip install --system -e . | |
| # Copy built frontend from the frontend-builder stage | |
| COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist | |
| # Also copy other necessary directories from root if the backend needs them | |
| COPY cop_analysis/ ./cop_analysis/ | |
| COPY data/ ./data/ | |
| # Expose Hugging Face Space port | |
| EXPOSE 7860 | |
| # Run uvicorn server | |
| WORKDIR /app/backend | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |