basecamp / Dockerfile
jpanasuk's picture
v2.0 pass 2: one-shot -z fix, 300s pull poll, model-rank boundaries, postgres validation, UI picker, cleanup, HEALTHCHECK
30a8b29
Raw
History Blame Contribute Delete
3.91 kB
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV OLLAMA_HOST=0.0.0.0:11434
ENV OLLAMA_MODELS=/root/.ollama/models
ENV BASECAMP_MODEL=llama3.1:8b
# ── System deps ──
# xz-utils is required by the Hermes installer (Node.js .tar.xz archive)
# The FIXER TOOLBOX: every CLI basecamp hermes needs to actually EXECUTE
# fixes, not just describe them (databases, docker, yaml, networking).
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip curl wget git ca-certificates xz-utils zstd \
supervisor procps jq gnupg \
# database clients β€” postgres/pgvector, sqlite, redis
postgresql-client sqlite3 redis-tools \
# docker CLI + compose plugin (for managing the stack when the
# docker socket is mounted into basecamp)
docker.io docker-compose-v2 \
# network diagnostics β€” the fixer must be able to SEE the network
iputils-ping dnsutils netcat-openbsd lsof \
# misc surgical tools
htop unzip file \
&& rm -rf /var/lib/apt/lists/* \
# yq (yaml editor) β€” not in Ubuntu 22.04 apt; official static binary
&& curl -fsSL -o /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64" \
&& chmod +x /usr/local/bin/yq \
# mongosh (mongo shell) β€” 'mongodb-clients' doesn't exist on 22.04;
# install the official shell from MongoDB's apt repo instead.
&& curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | gpg --dearmor -o /usr/share/keyrings/mongodb.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/mongodb.gpg] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" > /etc/apt/sources.list.d/mongodb.list \
&& apt-get update && apt-get install -y --no-install-recommends mongodb-mongosh \
&& rm -rf /var/lib/apt/lists/*
# ── Install Ollama ──
RUN curl -fsSL https://ollama.com/install.sh | sh
# ── Install Hermes Agent ──
# Official installer (root-mode FHS layout -> /usr/local/bin/hermes, data -> /root/.hermes).
# WARNING: do NOT `pip3 install hermes-cli` β€” that PyPI package is an unrelated
# 0.0.1.x stub, NOT Hermes Agent. Use the official installer only.
# --skip-browser keeps the image lean; browser tooling can be added later.
RUN curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash -s -- --skip-browser
ENV PATH="/usr/local/bin:/root/.local/bin:${PATH}"
# ── MCP SDK β€” required by hermes's native MCP client to connect to the
# tavern MCP server (tavern_mcp.py) and expose the connectivity toolkit
# as first-class tools (mcp_tavern_status, self_check, wire, ...).
# Installed BEFORE the app COPYs so app-file edits don't invalidate this
# layer (each rebuild would otherwise re-download the SDK). ──
RUN pip3 install --no-cache-dir --break-system-packages mcp 2>/dev/null \
|| pip3 install --no-cache-dir mcp
# ── Basecamp discovery + tools ──
RUN mkdir -p /opt/basecamp
COPY discover.py /opt/basecamp/discover.py
COPY recipes.py /opt/basecamp/recipes.py
COPY tavern.sh /opt/basecamp/tavern.sh
COPY tavern_mcp.py /opt/basecamp/tavern_mcp.py
COPY skins/ /opt/basecamp/skins/
COPY SOUL.md /opt/basecamp/SOUL.md
RUN chmod +x /opt/basecamp/discover.py /opt/basecamp/tavern.sh /opt/basecamp/tavern_mcp.py
# ── Supervisor config (Ollama only β€” Hermes is exec'd by the entrypoint) ──
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# ── Entrypoint ──
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 11434
# FIX v2.0: healthcheck β€” the box can look "up" while ollama is still
# starting or discovery is mid-scan. Report real readiness: ollama API
# answering AND (optionally) the generated tavern present.
HEALTHCHECK --interval=30s --timeout=5s --start-period=120s --retries=3 \
CMD curl -sf http://127.0.0.1:11434/api/tags > /dev/null 2>&1 || exit 1
WORKDIR /root
ENTRYPOINT ["/entrypoint.sh"]