| 1 | # syntax=docker/dockerfile:1 |
| 2 | # codewhale-cloud-agent — Daytona snapshot image for Codewhale cloud agents. |
| 3 | # |
| 4 | # Product truth first: this image installs the RELEASED v0.9.11 Linux x86_64 |
| 5 | # binary (static musl, no glibc floor) from the GitHub release by exact URL, |
| 6 | # verifies its sha256 against codewhale-artifacts-sha256.txt, and records the |
| 7 | # commit + digest as OCI labels (PRD 4.5: commit- and digest-pinned Linux |
| 8 | # binary inside the Computer). No secrets are baked in. Daytona create-time |
| 9 | # environment is server-visible, so a provider key must never be injected at |
| 10 | # create time. A future dispatcher must deliver provider secrets only after |
| 11 | # creation, over a post-create execution channel from stdin (never argv), and |
| 12 | # remove them during teardown. `CODEWHALE_API_KEY` is an account/machine token, |
| 13 | # not an inference-provider credential; current cloud dispatch has no |
| 14 | # server-side account-token-to-provider-key resolution. |
| 15 | # |
| 16 | # Build (Daytona, amd64 only; daytona snapshot create has no --build-arg, so |
| 17 | # every pin is inline): |
| 18 | # daytona snapshot create codewhale-cloud-agent \ |
| 19 | # -f Dockerfile --cpu 4 --memory 8 --disk 10 (plan max; resources bind to the snapshot) |
| 20 | # |
| 21 | # Dispatcher source selects this snapshot name, sends account identity, and |
| 22 | # uses the toolbox to clone and execute commands. That wiring does not prove |
| 23 | # provider-credential resolution or end-to-end Cloud Agent acceptance. See |
| 24 | # README.md beside this Dockerfile for the source and image evidence limits. |
| 25 | # Never substitute a create-time provider-key shortcut for that missing bridge. |
| 26 | |
| 27 | FROM debian:bookworm-slim |
| 28 | |
| 29 | ARG DEBIAN_FRONTEND=noninteractive |
| 30 | |
| 31 | # ---- pins (release v0.9.11, tag commit 96d13a0bc3f40280ea3865280ad5ccf0e2845e6f) |
| 32 | ENV CODEWHALE_VERSION=0.9.11 \ |
| 33 | CODEWHALE_COMMIT=96d13a0bc3f40280ea3865280ad5ccf0e2845e6f \ |
| 34 | CODEWHALE_ASSET_URL=https://github.com/Hmbown/CodeWhale/releases/download/v0.9.11/codewhale-linux-x64 \ |
| 35 | CODEWHALE_ASSET_SHA256=c02969556e51e138afa3fe9c97a1359878cd3d1986b1ce1f5fa96c93c6909416 \ |
| 36 | NODE_MAJOR=22 |
| 37 | |
| 38 | # Base toolchain for an agent doing code work: git, curl, TLS roots, ripgrep, |
| 39 | # python3, node LTS (22), build-essential. procps for `ps`/`pkill` used by the |
| 40 | # engine's process tooling; sudo is deliberately NOT installed. |
| 41 | RUN apt-get update \ |
| 42 | && apt-get install -y --no-install-recommends \ |
| 43 | ca-certificates curl git gnupg ripgrep procps \ |
| 44 | python3 python3-pip python3-venv \ |
| 45 | build-essential pkg-config \ |
| 46 | jq unzip xz-utils less \ |
| 47 | && mkdir -p /etc/apt/keyrings \ |
| 48 | && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \ |
| 49 | | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ |
| 50 | && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" \ |
| 51 | > /etc/apt/sources.list.d/nodesource.list \ |
| 52 | && apt-get update \ |
| 53 | && apt-get install -y --no-install-recommends nodejs \ |
| 54 | && rm -rf /var/lib/apt/lists/* |
| 55 | |
| 56 | # Download the released binary by exact URL and refuse anything whose sha256 |
| 57 | # does not match the release checksum. Static musl: no interpreter, no glibc. |
| 58 | RUN set -eu; \ |
| 59 | curl -fsSL --retry 3 -o /tmp/codewhale "${CODEWHALE_ASSET_URL}"; \ |
| 60 | echo "${CODEWHALE_ASSET_SHA256} /tmp/codewhale" | sha256sum -c -; \ |
| 61 | install -m 0755 -o root -g root /tmp/codewhale /usr/local/bin/codewhale; \ |
| 62 | ln -s /usr/local/bin/codewhale /usr/local/bin/codew; \ |
| 63 | rm -f /tmp/codewhale; \ |
| 64 | codewhale --version | tee /etc/codewhale-version; \ |
| 65 | grep -qx "codewhale 0.9.11 (96d13a0bc3f4)" /etc/codewhale-version |
| 66 | |
| 67 | # Non-root agent user. /work is the generic Computer mount; /workspace is the |
| 68 | # path #5712's runner clones into and runs the harness from — both owned by |
| 69 | # the agent so a non-root toolbox user can write them. |
| 70 | RUN groupadd --gid 1000 agent \ |
| 71 | && useradd --uid 1000 --gid 1000 --create-home --home-dir /home/agent --shell /bin/bash agent \ |
| 72 | && mkdir -p /work /workspace /home/agent/.codewhale \ |
| 73 | && chown -R agent:agent /work /workspace /home/agent |
| 74 | |
| 75 | ENV HOME=/home/agent \ |
| 76 | CODEWHALE_HOME=/home/agent/.codewhale \ |
| 77 | PATH=/home/agent/.local/bin:/usr/local/bin:/usr/bin:/bin \ |
| 78 | GIT_TERMINAL_PROMPT=0 \ |
| 79 | CI=1 \ |
| 80 | TERM=xterm-256color |
| 81 | |
| 82 | LABEL org.opencontainers.image.title="codewhale-cloud-agent" \ |
| 83 | org.opencontainers.image.description="Codewhale cloud agent Computer: released codewhale CLI preinstalled for dispatched turns" \ |
| 84 | org.opencontainers.image.version="0.9.11" \ |
| 85 | org.opencontainers.image.revision="96d13a0bc3f40280ea3865280ad5ccf0e2845e6f" \ |
| 86 | org.opencontainers.image.source="https://github.com/Hmbown/CodeWhale" \ |
| 87 | net.codewhale.binary.asset="codewhale-linux-x64" \ |
| 88 | net.codewhale.binary.sha256="c02969556e51e138afa3fe9c97a1359878cd3d1986b1ce1f5fa96c93c6909416" \ |
| 89 | net.codewhale.binary.commit="96d13a0bc3f40280ea3865280ad5ccf0e2845e6f" \ |
| 90 | net.codewhale.binary.version="0.9.11" \ |
| 91 | net.codewhale.release.image="ghcr.io/hmbown/codewhale:0.9.11@sha256:6de13fe5e62fb3cb815c423bcb17455bef4d9f7db2107888beb88fe4b7c9ac14" |
| 92 | |
| 93 | USER agent |
| 94 | WORKDIR /work |
| 95 | |
| 96 | # Daytona injects its own toolbox daemon; keep the container alive for it. |
| 97 | ENTRYPOINT ["sleep", "infinity"] |
| 98 |