Spaces:
Sleeping
Sleeping
| # ββ Stage 1: Build Frontend ββββββββββββββββββββββββββββββββββββββββββ | |
| FROM node:22-slim AS frontend-build | |
| WORKDIR /build/frontend | |
| COPY frontend/package.json frontend/package-lock.json* ./ | |
| RUN npm ci --no-audit --no-fund 2>/dev/null || npm install --no-audit --no-fund | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # ββ Stage 2: Python Runtime ββββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.11-slim | |
| # System dependencies for git clone operations | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends git && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Create non-root user (required by HF Spaces) | |
| RUN useradd -m -u 1000 appuser | |
| WORKDIR /app | |
| # Install Python dependencies | |
| COPY backend/requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy backend source | |
| COPY backend/ ./ | |
| # Copy built frontend into static/ | |
| COPY --from=frontend-build /build/frontend/dist ./static | |
| # Create directories for git clone temp storage | |
| RUN mkdir -p /app/cloned_repos && chown -R appuser:appuser /app | |
| USER appuser | |
| # HF Spaces expects port 7860 | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |