shopseenow / Dockerfile
fomext's picture
Upload 3 files
2022834 verified
Raw
History Blame Contribute Delete
2.4 kB
# ── Paperclip on Hugging Face Spaces ──────────────────────────────────────────
# - Listens on port 7860 (HF Spaces default, set in README.md app_port)
# - HF Spaces enforces UID 1000 at runtime
# - All state stored at /data/paperclip (HF Storage Bucket mount)
# - Uses opencode_local adapter β†’ Z.AI Coding Plan API
# Β· glm-5.2 β†’ primary model (complex tasks)
# Β· glm-4.7 β†’ small/fast model (titles, summaries, compaction)
#
# Fix: original docker-entrypoint.sh calls `gosu` to drop root→node, which
# fails on HF Spaces (already UID 1000, not root). We use our own entrypoint
# that starts `node /app/server/dist/index.js` directly.
# ──────────────────────────────────────────────────────────────────────────────
FROM ghcr.io/paperclipai/paperclip:latest
USER root
# Pre-create /data/paperclip so it exists even before the storage bucket mounts
RUN mkdir -p /data/paperclip && chown -R node:node /data
# Copy our custom entrypoint and opencode config
COPY entrypoint.sh /app/entrypoint.sh
COPY opencode.json /app/opencode.json
RUN chmod +x /app/entrypoint.sh && chown node:node /app/entrypoint.sh /app/opencode.json
# Drop to node user (UID 1000 in the base image) β€” matches HF Spaces runtime
USER node
# ── Runtime config ────────────────────────────────────────────────────────────
# PAPERCLIP_HOME=/data/paperclip β†’ all state on the HF Storage Bucket
# PORT=7860 β†’ HF Spaces default port
#
# Set these in HF Space Secrets (Settings β†’ Variables and Secrets):
# ZAI_API_KEY β€” your Z.AI Coding Plan API key
# BETTER_AUTH_SECRET β€” any long random string
# PAPERCLIP_PUBLIC_URL β€” https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
# PAPERCLIP_ALLOWED_HOSTNAMES β€” YOUR_USERNAME-YOUR_SPACE_NAME.hf.space
ENV HOST=0.0.0.0 \
PORT=7860 \
SERVE_UI=true \
PAPERCLIP_HOME=/data/paperclip \
PAPERCLIP_DEPLOYMENT_MODE=authenticated \
PAPERCLIP_DEPLOYMENT_EXPOSURE=private \
OPENCODE_ALLOW_ALL_MODELS=true
EXPOSE 7860
ENTRYPOINT ["/app/entrypoint.sh"]