Spaces:
Sleeping
Sleeping
| # Stage 1: Build Frontend | |
| FROM node:22-alpine as frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Stage 2: Build Backend and Final Image | |
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install system dependencies if any (e.g. for some pip packages) | |
| # RUN apt-get update && apt-get install -y gcc | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend code | |
| COPY backend/ ./backend/ | |
| # Copy built frontend from Stage 1 | |
| COPY --from=frontend-build /app/frontend/dist ./frontend/dist | |
| # Expose the correct port for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Command to run the application | |
| # We use host 0.0.0.0 and port 7860 (required by HF Spaces) | |
| CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |