Spaces:
Sleeping
Sleeping
| # Build Stage for Frontend | |
| FROM node:20-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ . | |
| RUN npm run build | |
| # Final Stage for Backend and Serving | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # Install system dependencies if needed | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend code | |
| COPY app.py . | |
| COPY main.py . | |
| # Copy frontend build from previous stage | |
| COPY --from=frontend-build /app/frontend/dist ./frontend/dist | |
| # Expose the port (Hugging Face Spaces use 7860 by default) | |
| EXPOSE 7860 | |
| # Command to run the application | |
| # We use 0.0.0.0 to allow external connections | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |