# ── Stage 1: build frontend ────────────────────────────────────────────────── FROM node:20-slim AS frontend-builder WORKDIR /build/frontend COPY skillwiki-frontend/package*.json ./ # Skip Puppeteer Chrome download (only needed for PDF scripts, not the app) ENV PUPPETEER_SKIP_DOWNLOAD=true RUN npm ci --prefer-offline COPY skillwiki-frontend/ ./ # Disable WebSocket in the hosted build (HF Spaces doesn't support it) ENV VITE_SKILLOS_DISABLE_WS=1 RUN npm run build # ── Stage 2: runtime ───────────────────────────────────────────────────────── FROM python:3.11-slim WORKDIR /app # Install slim Python deps (no heavy DB drivers) COPY skillwiki/requirements-hf.txt ./requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Install the skillwiki package COPY skillwiki/ ./skillwiki/ RUN pip install --no-cache-dir -e ./skillwiki # Copy built frontend COPY --from=frontend-builder /build/frontend/dist ./frontend/dist # HF Spaces runs as user 1000 RUN useradd -m -u 1000 skillwiki && chown -R skillwiki:skillwiki /app USER 1000 # HF Spaces requires port 7860 EXPOSE 7860 ENV LLM_API_URL=https://api.deepseek.com ENV LLM_MODEL=deepseek-chat ENV SKILLWIKI_FRONTEND_DIST=/app/frontend/dist CMD ["python", "-m", "skillwiki.api.main", "--host", "0.0.0.0", "--port", "7860", "--repository-backend", "memory"]