# pybot world image: World API v1 on $PORT (7860). Build from this directory: # docker build -t /pybot-world: world/ # The same image runs the bot sandbox sidecar (command `python sandbox.py serve`). The base is # pinned by digest (3.12: the seed's bot imports `copy`, which the bot sandbox allows only on # 3.12+); Python deps are legion's own uv.lock (exact versions + hashes), and legion itself is # installed at the commit that lock comes from (README, "The legion pin"). FROM python:3.12.15-slim-bookworm@sha256:6a0e06f5ba0b373d051aabd3fffb9b873f27f9a2a3a14bcbe37dee6f0e3bbc70 # git: the world's bare repo, fetches and pushes to the Hub, and pip's legion checkout. # util-linux (unshare) ships in the base. RUN apt-get update \ && apt-get install -y --no-install-recommends git \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt /opt/world/requirements.txt RUN pip install --no-cache-dir --no-deps --require-hashes -r /opt/world/requirements.txt # legion's World API library, pinned to a commit (pip cannot hash a git requirement, so it gets its # own install). --no-deps: its deps are the hashed ones above; the world needs no Harbor or board. RUN pip install --no-cache-dir --no-deps \ "legion @ git+https://github.com/huggingface/legion@803873b114d5e04a3a01fea5e2e9084a03596fab" COPY pybot.py repository.py sandbox.py snapshot.py /opt/world/ COPY seed/ /opt/world/seed/ COPY --chmod=755 entrypoint.sh /usr/local/bin/pybot-entrypoint RUN useradd -m -u 1000 user && mkdir -p /work && chown user:user /work USER user # For the sidecar's bare `python sandbox.py serve` (a job command replaces the entrypoint); the # entrypoint sets its own cwd, so the world does not depend on it. WORKDIR /opt/world EXPOSE 7860 ENTRYPOINT ["/usr/local/bin/pybot-entrypoint"]