From 7df4f06ae0e3ae80bd967bf53cbec36e58b4a3bd Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 18 Mar 2026 23:56:20 +0000 Subject: feat: containerized execution with agent tooling and deployment fixes - ContainerRunner replaces ClaudeRunner/GeminiRunner; all agent types run in Docker containers via claudomator-agent:latest - Writable agentHome staging dir (/home/agent) satisfies home-dir requirements for both claude and gemini CLIs without exposing host creds - Copy .credentials.json and .claude.json into staging dir at run time; GEMINI_API_KEY passed via env file - Fix git clone: remove MkdirTemp-created dir before cloning (git rejects pre-existing dirs even when empty) - Replace localhost with host.docker.internal in APIURL so container can reach host API; add --add-host=host.docker.internal:host-gateway - Run container as --user=$(uid):$(gid) so host-owned workspace files are readable; chmod workspace 0755 and instructions file 0644 after clone - Pre-create .gemini/ in staging dir to avoid atomic-rename ENOENT on first gemini-cli run - Add ct CLI tool to container image: pre-built Bash wrapper for Claudomator API (ct task submit/create/run/wait/status/list) - Document ct tool in CLAUDE.md agent instructions section - Add drain-failed-tasks script: retries failed tasks on a 5-minute interval - Update Dockerfile: Node 22 via NodeSource, Go 1.24, gemini-cli, git safe.directory=*, default ~/.claude.json Co-Authored-By: Claude Sonnet 4.6 --- images/agent-base/Dockerfile | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'images/agent-base/Dockerfile') diff --git a/images/agent-base/Dockerfile b/images/agent-base/Dockerfile index 6fb253c..0e8057c 100644 --- a/images/agent-base/Dockerfile +++ b/images/agent-base/Dockerfile @@ -1,45 +1,58 @@ # Claudomator Agent Base Image FROM ubuntu:24.04 -# Avoid interactive prompts ENV DEBIAN_FRONTEND=noninteractive -# Install core build and dev tools +# Base system tools RUN apt-get update && apt-get install -y \ git \ curl \ make \ wget \ - nodejs \ - npm \ sqlite3 \ jq \ sudo \ + ca-certificates \ && rm -rf /var/lib/apt/lists/* -# Install Go 1.22+ -RUN wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz && \ - rm go1.22.1.linux-amd64.tar.gz +# Node.js 22 via NodeSource +RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get install -y nodejs \ + && rm -rf /var/lib/apt/lists/* + +# Go 1.24 +RUN wget -q https://go.dev/dl/go1.24.1.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz && \ + rm go1.24.1.linux-amd64.tar.gz ENV PATH=$PATH:/usr/local/go/bin -# Install Claude CLI +# Claude Code CLI RUN npm install -g @anthropic-ai/claude-code -# Install specific node tools +# Gemini CLI +RUN npm install -g @google/gemini-cli + +# CSS build tools (for claudomator itself) RUN npm install -g postcss-cli tailwindcss autoprefixer +# Git: allow operations on any directory (agents clone into /workspace/*) +RUN git config --system safe.directory '*' + +# Claudomator agent CLI tools (ct) +COPY tools/ct /usr/local/bin/ct +RUN chmod +x /usr/local/bin/ct + # Setup workspace WORKDIR /workspace -# Add a user claudomator-agent +# Agent user with passwordless sudo RUN useradd -m claudomator-agent && \ echo "claudomator-agent ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers -# Ensure /usr/local/bin is writable for npm or use a different path -# @anthropic-ai/claude-code might need some extra setup or just work - USER claudomator-agent -# Default command +# Create a default empty config to satisfy the CLI if no mount is provided +RUN mkdir -p /home/claudomator-agent/.claude && \ + echo '{}' > /home/claudomator-agent/.claude.json + CMD ["/bin/bash"] -- cgit v1.2.3