| # Build Frontend | |
| FROM node:20 AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json ./ | |
| RUN npm install | |
| COPY frontend . | |
| RUN npm run build | |
| # Setup Backend | |
| FROM python:3.10 | |
| WORKDIR /app | |
| # Install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy Backend Code | |
| COPY backend ./backend | |
| # Note: .env is not copied. Secrets are handled via HF Spaces env vars. | |
| # Copy Built Frontend to Static Directory expected by backend.py | |
| COPY --from=frontend-builder /app/frontend/dist ./static | |
| # Expose port 7860 | |
| EXPOSE 7860 | |
| # Run Application | |
| CMD ["python", "backend/backend.py"] | |