File size: 1,520 Bytes
adf68aa
 
 
 
c786dae
adf68aa
 
 
 
 
 
 
 
 
 
c786dae
adf68aa
 
 
 
 
 
 
 
 
 
 
 
 
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
# pybot world image: World API v1 on $PORT (7860). Build from this directory:
#   docker build -t <registry>/pybot-world:<tag> 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, see vendor.sh).
FROM python:3.12.15-slim-bookworm@sha256:6a0e06f5ba0b373d051aabd3fffb9b873f27f9a2a3a14bcbe37dee6f0e3bbc70

# git: the world's bare repo, fetches and pushes to the Hub. 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

# src/: legion's World API library, vendored by vendor.sh (hashes in source-lock.json), never edited.
COPY src/ /opt/world/src/
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 PYTHONPATH and cwd, so the world does not depend on these.
ENV PYTHONPATH=/opt/world/src
WORKDIR /opt/world
EXPOSE 7860
ENTRYPOINT ["/usr/local/bin/pybot-entrypoint"]