Download Dockerfile from ruslanmv/HomePilot: direct link, hf CLI and curl.
- Browser
- Download file 3.84 kB
-
https://huggingface.co/spaces/ruslanmv/HomePilot/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ruslanmv/HomePilot/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ruslanmv/HomePilot/resolve/main/Dockerfile
3.84 kB
| # ============================================================================= | |
| # HomePilot β Hugging Face Spaces Dockerfile | |
| # ============================================================================= | |
| # Three-stage build: | |
| # 1. Build React frontend (Vite) | |
| # 2. Runtime: Ollama + FastAPI + pre-built frontend + Chata personas | |
| # | |
| # HF Spaces constraints: | |
| # - Must listen on port 7860 | |
| # - Only /tmp is writable at runtime | |
| # - Free tier: 2 vCPU, 16GB RAM, no GPU | |
| # ============================================================================= | |
| # ββ Stage 1: Frontend build ββββββββββββββββββββββββββββββ | |
| FROM node:20-alpine AS frontend | |
| WORKDIR /build | |
| COPY frontend/package.json frontend/package-lock.json* ./ | |
| RUN npm install --no-audit --no-fund 2>/dev/null | |
| COPY frontend/ ./ | |
| # Wave B monorepo: frontend resolves @homepilot/* from ../packages via build-time | |
| # aliases. WORKDIR is /build, so ../packages must be at /packages. TS source, | |
| # not npm deps β the npm install above is unchanged. | |
| COPY packages/ /packages/ | |
| # Package tsconfigs extend ../../tsconfig.base.json. Because packages live at | |
| # /packages in this standalone frontend stage, that path resolves to | |
| # /tsconfig.base.json. Vite/esbuild reads it while transforming package source. | |
| COPY tsconfig.base.json /tsconfig.base.json | |
| ENV VITE_API_URL="" | |
| RUN npm run build && ls -la dist/ | |
| # ββ Stage 2: Runtime βββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.11-slim | |
| # System deps + Ollama | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| curl ca-certificates procps zstd \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && curl -fsSL https://ollama.com/install.sh | sh | |
| # HF Spaces user (uid 1000) | |
| RUN useradd -m -u 1000 hpuser && \ | |
| mkdir -p /app /tmp/ollama /tmp/homepilot/data \ | |
| /tmp/homepilot/uploads /tmp/homepilot/outputs && \ | |
| chown -R hpuser:hpuser /app /tmp/ollama /tmp/homepilot | |
| WORKDIR /app | |
| # Python deps (cached layer) | |
| COPY backend/requirements.txt ./requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Backend source | |
| COPY backend/app ./app | |
| # Ensure __init__.py exists (created by deploy script) | |
| RUN touch ./app/__init__.py | |
| # The model installer (POST /models/install) runs this for ComfyUI and Civitai downloads; | |
| # the backend finds the copy next to its package (app/download_script.py). | |
| COPY scripts/download.py ./scripts/download.py | |
| # Expert β the chat's Fast / Expert / Heavy path (/v1/expert/*). The backend looks for it | |
| # next to its package when there is no repo around (app/main.py). Without it every chat | |
| # POST fell through to the frontend catch-all below and came back HTTP 405. | |
| COPY expert/backend/app/expert ./expert | |
| # Community persona samples | |
| COPY community/sample ./community/sample | |
| # Chata personas (pre-installed) | |
| COPY deploy/huggingface-space/chata-personas ./chata-personas | |
| # Pre-built frontend from stage 1 | |
| COPY --from=frontend /build/dist ./frontend | |
| # HF Space wrapper (serves frontend + patches config) | |
| COPY deploy/huggingface-space/hf_wrapper.py ./hf_wrapper.py | |
| COPY deploy/huggingface-space/auto_import_personas.py ./auto_import_personas.py | |
| COPY deploy/huggingface-space/chata_project_bootstrap.py ./chata_project_bootstrap.py | |
| # Startup script (copied to root by deploy script), and the commit this image is built from | |
| # (build-info.json, written by the deploy script; GET /version serves it). The glob lets a | |
| # local build without it go through: COPY needs only one of its sources to exist. | |
| COPY start.sh build-info.json* ./ | |
| RUN chmod +x start.sh | |
| USER hpuser | |
| EXPOSE 7860 | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=90s --retries=3 \ | |
| CMD curl -fsS http://127.0.0.1:7860/health || exit 1 | |
| CMD ["./start.sh"] | |