Spaces:
Running
Running
| # ββ Stage 1: Build React frontend ββ | |
| FROM node:20-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json frontend/package-lock.json* ./ | |
| RUN npm ci --production=false | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # ββ Stage 2: Production image ββ | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install Python dependencies | |
| COPY backend/requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend code | |
| COPY backend/ ./ | |
| # Copy built frontend into backend's static directory | |
| COPY --from=frontend-build /app/frontend/dist ./static | |
| # HuggingFace Spaces requires port 7860 | |
| EXPOSE 7860 | |
| # Run with uvicorn (production) | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |