mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
fix(grok): install grok CLI to ~/.grok/bin (its real default), not ~/.local/bin
The image build failed at `chown ... /home/agent/.local: No such file or
directory`. The grok installer's default is $HOME/.grok/bin — the binary lands at
~/.grok/bin/grok; ~/.local/bin/grok is only a convenience SYMLINK the installer
creates on macOS but not in the Linux container. So the Dockerfile referenced a
directory that never existed:
- PATH pointed at ~/.local/bin -> `grok` would not be found at runtime even if
the build had passed;
- chown targeted ~/.local -> the build aborted.
Point PATH + chown at ~/.grok/bin / ~/.grok. Also harden the install: download the
script to a file (a `curl | bash` pipe swallows a curl failure as a silent no-op)
and verify the binary installed and runs (`test -x` + `grok --version`), so a
broken install fails the build loudly instead of producing a grok-less image.
This commit is contained in:
@@ -14,26 +14,32 @@ FROM roboco-agent-base
|
||||
|
||||
USER root
|
||||
|
||||
# Install the official grok CLI (Grok Build) for the agent user: the binary lands
|
||||
# at ~/.local/bin/grok and its runtime (bin / bundled / skills) at ~/.grok, both
|
||||
# agent-owned. Pinned — untrusted model output runs under it, so bump the version
|
||||
# deliberately, never float. (curl + bash are provided by roboco-agent-base.)
|
||||
# Install the official grok CLI (Grok Build) for the agent user. The installer's
|
||||
# default is $HOME/.grok/bin, so the binary lands at ~/.grok/bin/grok alongside
|
||||
# its runtime (downloads / bundled / skills) under ~/.grok, all agent-owned.
|
||||
# Pinned — untrusted model output runs under it, so bump the version deliberately,
|
||||
# never float. Download the installer to a file first (a `curl | bash` pipe hides
|
||||
# a curl failure as a silent no-op) and verify the binary installed AND runs, so
|
||||
# a broken install fails the build here, not at spawn. (curl/bash from the base.)
|
||||
ARG GROK_CLI_VERSION=0.2.56
|
||||
RUN su agent -s /bin/bash -c "export HOME=/home/agent; \
|
||||
curl -fsSL https://x.ai/cli/install.sh | bash -s ${GROK_CLI_VERSION}" \
|
||||
RUN su agent -s /bin/bash -c "set -euo pipefail; export HOME=/home/agent; \
|
||||
curl -fsSL https://x.ai/cli/install.sh -o /tmp/grok-install.sh; \
|
||||
bash /tmp/grok-install.sh ${GROK_CLI_VERSION}; \
|
||||
test -x /home/agent/.grok/bin/grok; \
|
||||
/home/agent/.grok/bin/grok --version" \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
# Entrypoint: render ~/.grok/config.toml + the per-role flags, then run grok
|
||||
# headless (overrides the base image's `claude` entrypoint).
|
||||
COPY docker/scripts/grok-cli-agent-entrypoint.sh /app/scripts/grok-cli-agent-entrypoint.sh
|
||||
RUN chmod 0755 /app/scripts/grok-cli-agent-entrypoint.sh \
|
||||
&& chown -R agent:agent /home/agent/.grok /home/agent/.local
|
||||
&& chown -R agent:agent /home/agent/.grok
|
||||
|
||||
USER agent
|
||||
|
||||
# grok installs to ~/.local/bin; put it ahead of the venv on PATH so the
|
||||
# grok installs to ~/.grok/bin; put it ahead of the venv on PATH so the
|
||||
# entrypoint finds `grok` (and still resolves `python` to /app/.venv/bin).
|
||||
ENV PATH="/home/agent/.local/bin:/app/.venv/bin:$PATH"
|
||||
ENV PATH="/home/agent/.grok/bin:/app/.venv/bin:$PATH"
|
||||
|
||||
LABEL role="grok-cli-runtime"
|
||||
LABEL description="Grok (xAI) agent runtime — Grok Build via the official grok CLI"
|
||||
|
||||
Reference in New Issue
Block a user