Spaces:
Running
Running
# --- Frontend Stage (React + Vite) --- | |
FROM node:20-alpine AS frontend | |
WORKDIR /ui | |
# Copy package files and install deps | |
COPY frontend/package*.json ./ | |
RUN npm ci --silent || npm install --silent | |
# Copy frontend source and build | |
COPY frontend ./ | |
RUN npm run build | |
# --- Backend Stage (FastAPI + Python) --- | |
FROM python:3.11-slim | |
WORKDIR /app | |
# Install Python dependencies | |
COPY requirements.txt ./ | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy backend code | |
COPY backend ./backend | |
COPY app.py Procfile .env.example ./ | |
# Copy built frontend from frontend stage | |
COPY --from=frontend /ui/dist ./frontend_dist | |
# Bust cache so Hugging Face doesn’t reuse stale Node layers | |
ARG CACHE_BUST=1 | |
EXPOSE 7860 | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |