Spaces:
Running
Running
| # Stage 1: build the React frontend | |
| FROM node:20-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Stage 2: Python backend + built frontend | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # System deps for OpenCV and PyMuPDF | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgl1 libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY backend/ ./backend/ | |
| COPY scripts/ ./scripts/ | |
| COPY --from=frontend-build /app/frontend/dist ./frontend/dist | |
| # HF Spaces serves apps on port 7860 | |
| EXPOSE 7860 | |
| CMD ["sh", "-c", "python scripts/init_db.py && uvicorn backend.main:app --host 0.0.0.0 --port 7860"] |