| # Stage 1: Build the Vite frontend | |
| FROM node:18-alpine AS frontend-builder | |
| WORKDIR /app/dashboard | |
| COPY dashboard/package*.json ./ | |
| RUN npm ci | |
| COPY dashboard/ ./ | |
| RUN npm run build | |
| # Stage 2: Serve the backend with FastAPI | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install Python backend dependencies | |
| COPY backend/requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the entire project code | |
| COPY . /app | |
| # Copy the compiled frontend output from the builder stage | |
| COPY --from=frontend-builder /app/dashboard/dist /app/dashboard/dist | |
| # Expose the port Hugging Face Spaces expects | |
| EXPOSE 7860 | |
| # Set environment variables for production behavior | |
| ENV NOTIFLOW_DEMO_MODE=false | |
| # Start the uvicorn server on the HF port | |
| CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"] | |