-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile.episode_runner
More file actions
67 lines (58 loc) · 2.97 KB
/
Dockerfile.episode_runner
File metadata and controls
67 lines (58 loc) · 2.97 KB
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
57
58
59
60
61
62
63
64
65
66
67
FROM ubuntu:24.04
ARG COGAMES_VERSION=""
ARG GIT_COMMIT=""
ENV COGAMES_VERSION=${COGAMES_VERSION}
ENV GIT_COMMIT=${GIT_COMMIT}
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:0.11.6 /uv /uvx /bin/
# Install Nim via nimby (matches .nim-version / .nimby-version).
ARG NIMBY_VERSION=0.1.26
ARG NIM_VERSION=2.2.6
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "aarch64" ]; then NIMBY_ARCH="Arm64"; else NIMBY_ARCH="X64"; fi && \
curl -fsSL "https://github.com/treeform/nimby/releases/download/${NIMBY_VERSION}/nimby-Linux-${NIMBY_ARCH}" \
-o /usr/local/bin/nimby && \
chmod +x /usr/local/bin/nimby && \
nimby use ${NIM_VERSION}
ENV PATH="/root/.nimby/nim/bin:$PATH"
# Build native BitWorld server assets used by mettagrid.runner.bitworld_runner.
# The Python BitWorld package remains an optional Cogames extra; this image
# only needs the native server binary and static assets.
ARG BITWORLD_REF=63191512d486fa56c86e7b53893884b67e746fe7
ARG MUMMY_REF=31ea34f2f6f8aa880ac65bc136373dc06568fcd9
RUN chmod +x /root/.nimby/nim/bin/* && \
export PATH="/root/.nimby/nim/bin:$PATH" && \
git clone https://github.com/guzba/mummy.git /tmp/mummy && \
cd /tmp/mummy && git checkout ${MUMMY_REF} && \
nimble install -y && \
git clone https://github.com/Metta-AI/BitWorld.git /tmp/bitworld && \
cd /tmp/bitworld && git checkout ${BITWORLD_REF} && \
nimble install -y pixie jsony zippy webby crunchy && \
mkdir -p /opt/bitworld/among_them /opt/bitworld/client/data && \
nim c -d:release --threads:on --mm:orc --path:common -o:/opt/bitworld/among_them/among_them among_them/among_them.nim && \
cp among_them/*.png among_them/*.aseprite /opt/bitworld/among_them/ && \
cp client/data/pallete.png client/data/letters.png client/data/numbers.png /opt/bitworld/client/data/ && \
rm -rf /tmp/bitworld /tmp/mummy /root/.nimble/pkgs2
# Install Python and create the executor venv with cogames[neural]
# (pulls in mettagrid[train], torch, pufferlib-core, einops).
ENV UV_HTTP_TIMEOUT=300
ENV UV_TORCH_BACKEND=cpu
RUN uv python install 3.12 && uv venv /opt/executor
RUN --mount=type=bind,target=/ctx \
if ls /ctx/cogames-*.whl 1>/dev/null 2>&1; then \
COGAMES_WHEEL=$(ls /ctx/cogames-*.whl) && \
uv pip install --python /opt/executor/bin/python --find-links /ctx "${COGAMES_WHEEL}[neural]"; \
elif [ -n "${COGAMES_VERSION}" ]; then \
uv pip install --python /opt/executor/bin/python "cogames[neural]==${COGAMES_VERSION}"; \
else \
echo "ERROR: provide .whl in build context or set COGAMES_VERSION" && exit 1; \
fi
# Freeze executor packages so policy venvs get the same set (cogames, mettagrid, torch, etc).
RUN uv pip list --python /opt/executor/bin/python --format=freeze > /opt/policy-requirements.txt
ENV PATH="/opt/executor/bin:$PATH"
ENTRYPOINT ["python", "-m", "mettagrid.runner.executor"]