Spaces:
Running
Running
| # Stage 1: Build Frontend | |
| FROM node:20 AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Stage 2: Backend & Serve | |
| FROM python:3.12-slim | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/* | |
| # Copy and install backend dependencies | |
| COPY backend/requirements.txt ./backend/ | |
| RUN pip install --no-cache-dir -r backend/requirements.txt | |
| # Copy backend and middleware code | |
| COPY backend/ ./backend/ | |
| COPY middleware/ ./middleware/ | |
| # Copy the built frontend from Stage 1 | |
| COPY --from=frontend-build /app/frontend/dist ./frontend/dist | |
| # Hugging Face requires port 7860 | |
| EXPOSE 7860 | |
| # Start the server | |
| CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"] | |