build-small-hackathon/puck
1
1# Puck — Hugging Face Space (Docker SDK).2# Two stages: build the React UI, then run the gr.Server daemon that serves it AND3# proxies "peeks" to the cloud (Modal) vision brain. The macOS-only paths (screen OCR,4# `say` voice, ONNX recognizer) self-disable on Linux; the Space hosts the browser SIM,5# whose vision runs against Modal. Custom UI over gr.Server = the Off-Brand badge.6 7# ---- stage 1: build the frontend ----8FROM node:24-slim AS web9WORKDIR /web10COPY frontend/package.json frontend/package-lock.json* ./11RUN npm ci || npm install12COPY frontend/ ./13RUN npm run build # → /web/dist14 15# ---- stage 2: python daemon ----16FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim17# HF Spaces run as uid 1000 — give it a writable HOME for the peek log + uv cache.18RUN useradd -m -u 1000 user19ENV HOME=/home/user \20 PATH=/home/user/.local/bin:$PATH \21 UV_LINK_MODE=copy \22 UV_COMPILE_BYTECODE=1 \23 PUCK_HOST=0.0.0.0 \24 PORT=7860 \25 PUCK_VISION_URL=https://vuluan--puck-brain-serve.modal.run/v1 \26 PUCK_VISION_MODEL=Hcompany/Holotron-12B \27 PUCK_VISION_TIMEOUT=12028WORKDIR /home/user/app29 30# deps first (cached across code edits); the server's lockfile drives the resolve31COPY --chown=user:user server/pyproject.toml server/uv.lock ./server/32RUN cd server && uv sync --no-dev33 34# app code + the assets app.py reads at import (schema/) + the built UI35COPY --chown=user:user server/ ./server/36COPY --chown=user:user schema/ ./schema/37COPY --chown=user:user --from=web /web/dist ./frontend/dist38RUN mkdir -p server/data && chown -R user:user /home/user/app39 40USER user41EXPOSE 786042WORKDIR /home/user/app/server43# Run the venv's interpreter directly — no `uv` at runtime (it would hit a root-owned44# build-time cache, and we don't want a re-resolve on boot). The env is already synced.45CMD ["/home/user/app/server/.venv/bin/python", "app.py"]46 