Spaces:
Running
Running
File size: 3,105 Bytes
e36381e f7e1070 d6df680 f7e1070 e36381e f7e1070 e36381e f7e1070 266304a e36381e 266304a f7e1070 e36381e f7e1070 e36381e f7e1070 | 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 48 49 50 51 52 53 54 55 56 | # Surrogate-1 on Hugging Face Spaces (CPU 16 GB)
# Single-container that runs Ollama + Redis + all Surrogate daemons.
FROM python:3.12-slim
# ββ System deps ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
RUN apt-get update && apt-get install -y --no-install-recommends \
bash curl wget git ca-certificates jq sqlite3 redis-server \
ripgrep fswatch procps net-tools zstd \
&& rm -rf /var/lib/apt/lists/*
# ββ Ollama (CPU build for ARM/x86) ββββββββββββββββββββββββββββββββββββββββββ
RUN curl -fsSL https://ollama.com/install.sh | sh
# ββ App user (HF Spaces requires uid 1000) ββββββββββββββββββββββββββββββββββ
RUN useradd -m -u 1000 hermes
ENV HOME=/home/hermes \
PATH=/home/hermes/.surrogate/bin:/home/hermes/.local/bin:/usr/local/bin:/usr/bin:/bin \
SURROGATE_HOME=/home/hermes/.surrogate \
HERMES_HOME=/home/hermes/.hermes \
PYTHONUNBUFFERED=1
WORKDIR /home/hermes
# ββ Python deps for Discord bot + scrape + RAG ββββββββββββββββββββββββββββββ
COPY --chown=hermes:hermes requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
# ββ Copy Surrogate scripts + agents + config skeleton ββββββββββββββββββββββ
# Surrogate's home: ~/.surrogate/bin/ (separate from Claude Code's ~/.claude/)
COPY --chown=hermes:hermes bin/ /home/hermes/.surrogate/bin/
COPY --chown=hermes:hermes agents/ /home/hermes/.surrogate/agents/
COPY --chown=hermes:hermes config/ /home/hermes/.hermes/config/
COPY --chown=hermes:hermes start.sh /home/hermes/start.sh
RUN chmod +x /home/hermes/.surrogate/bin/*.sh /home/hermes/start.sh
USER hermes
# ββ Persistent dirs (HF mounts /data into ~/.surrogate symlink) βββββββββββββ
RUN mkdir -p /home/hermes/.surrogate/state /home/hermes/.surrogate/logs \
/home/hermes/.surrogate/workspace /home/hermes/.surrogate/memory \
/home/hermes/.surrogate/skills /home/hermes/.surrogate/sessions \
/home/hermes/.hermes/workspace /home/hermes/.ollama
# ββ Backward-compat: legacy refs to ~/.claude/bin/ + ~/.claude/logs/ ββββββββ
# Some scripts still reference old paths; symlink prevents breakage during
# progressive migration. Eventually all callers should use ~/.surrogate/.
RUN mkdir -p /home/hermes/.claude && \
ln -sfn /home/hermes/.surrogate/bin /home/hermes/.claude/bin && \
ln -sfn /home/hermes/.surrogate/logs /home/hermes/.claude/logs && \
ln -sfn /home/hermes/.surrogate/state /home/hermes/.claude/state
# ββ Expose port 7860 (HF default) ββββββββββββββββββββββββββββββββββββββββββββ
EXPOSE 7860
CMD ["/home/hermes/start.sh"]
|