Spaces:
Running
Running
File size: 1,299 Bytes
8b9f7d9 6775581 8b9f7d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# ===========================================================================
# Learn Pathophysiology — WC3 Edition
# Multi-stage build: Vue frontend + FastAPI backend
# Deploy: HuggingFace Spaces (Docker SDK)
# ===========================================================================
# ---------- Stage 1: Build Vue Frontend ----------
FROM node:20-slim AS frontend-build
WORKDIR /build
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm install
COPY frontend/ ./
# Skip vue-tsc type checking (storybook files have TS errors) — just run vite build
RUN npx vite build
# Output goes to /build/dist/
# ---------- Stage 2: Python Backend + Serve Static ----------
FROM python:3.11-slim
WORKDIR /app
# Install Python deps
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY backend/ ./
# Copy built frontend from stage 1
COPY --from=frontend-build /build/dist ./static/
# Copy chroma_db (must be present in docker build context)
COPY chroma_db/ ./chroma_db/
# Environment
ENV PORT=7860
ENV CHROMA_DIR=/app/chroma_db
# Auth (set via HuggingFace Spaces secrets)
# ENV GOOGLE_CLIENT_ID=...
# ENV JWT_SECRET=...
# ENV GEMINI_API_KEY=...
EXPOSE 7860
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]
|