Skip to content

feat(claude-code): add headless Claude Code agent image - #2

Merged
swibrow merged 1 commit into
mainfrom
feat/claude-code-image
Jul 25, 2026
Merged

feat(claude-code): add headless Claude Code agent image#2
swibrow merged 1 commit into
mainfrom
feat/claude-code-image

Conversation

@swibrow

@swibrow swibrow commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Adds ghcr.io/cloudsnacks/claude-code: a headless Claude Code agent for sandboxed runs.

Design

  • Base: ghcr.io/cloudsnacks/sandbox-agent:1.0.0, digest-pinned. Inherits Node, Python, uv, git, gh, ripgrep, the agent user (uid 1001) and /workspace.
  • Version: tracks @anthropic-ai/claude-code (2.1.220). The metadata.yaml version carries the same # renovate: datasource=npm annotation as the Dockerfile ARG, so both bump together.
  • Run mode: ENTRYPOINT bootstraps, then exec "$@". Default CMD is a one-shot claude -p; any command passed in replaces it, so the same image works for a Job and for a long-lived sandbox pod driven over exec.
  • Bootstrap: the entrypoint is a plain script ending in exec, so PID 1 is still claude - one process, no init framework. An init container is not required, though it remains an option if you'd rather keep clone credentials out of the agent pod.

Configuration

All optional; with nothing set the agent starts in an empty /workspace scratch space.

Variable Effect
AGENT_REPO / AGENT_REPO_REF Repo cloned into the workspace (skipped if it already contains .git, so a persistent volume survives restarts)
AGENT_PROFILE_REPO / AGENT_PROFILE / AGENT_PROFILE_REF Profile repo shallow-cloned; the named subdirectory (or the repo root) is copied into CLAUDE_CONFIG_DIR
AGENT_PROMPT Piped to the command on stdin
AGENT_WORKSPACE Working directory, default /workspace
GITHUB_TOKEN Sets a git insteadOf rewrite for authenticated clones

Verified locally (arm64, Apple container)

  • hadolint (repo config) and shellcheck clean.
  • metadata.yaml test passes; whoami is agent, uid/gid 1001.
  • Repo clone, profile-from-root, profile-from-subdirectory with a branch ref, and AGENT_PROMPT-on-stdin all work.
  • A missing profile directory exits 1; the default CMD with no prompt errors out rather than hanging.

Note for review

This image ships a third file, entrypoint.sh, where existing images have two. The build context is the image directory so CI handles it fine; the alternative was a ~35-line heredoc inside the Dockerfile, which loses shellcheck coverage. Happy to inline it if the two-file convention should stay strict.

Builds on sandbox-agent and installs the Claude Code CLI. The entrypoint
optionally clones a target repo into /workspace and installs an agent
profile from a git repo into CLAUDE_CONFIG_DIR before exec'ing the
container command, defaulting to a one-shot 'claude -p' run. With no
variables set the agent starts in an empty /workspace scratch space.

Signed-off-by: swibrow <15628653+swibrow@users.noreply.github.com>
@swibrow
swibrow merged commit dd7ea14 into main Jul 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant