Spaces:
Sleeping
Sleeping
| # Stage 1: Build the React frontend | |
| FROM node:20-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json frontend/package-lock.json ./ | |
| RUN npm ci --legacy-peer-deps | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Stage 2: Python backend + built frontend | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| RUN useradd -m -u 1000 appuser | |
| COPY backend/requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY backend/main.py . | |
| COPY --from=frontend-build /app/frontend/dist ./static/ | |
| RUN chown -R appuser:appuser /app | |
| USER appuser | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |