From 0c84ac829dfd88d5b2ac2855a4a36aa7f3f427df Mon Sep 17 00:00:00 2001 From: kirnap Date: Wed, 13 Aug 2025 04:08:15 +0000 Subject: [PATCH 1/2] fix: Improve local deployment and worker execution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix Claude CLI accessibility for non-root users in worker container - Update service account name from claude-worker to peerbot - Fix variable name typo in entrypoint.sh - Use bun instead of node for worker execution 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Dockerfile.worker | 9 +++++++-- packages/dispatcher/src/kubernetes/job-manager.ts | 2 +- packages/worker/scripts/entrypoint.sh | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Dockerfile.worker b/Dockerfile.worker index 7064bc088..d6fcd553d 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -15,18 +15,23 @@ RUN apk add --no-cache \ RUN addgroup -g 1001 claude && \ adduser -u 1001 -G claude -h /home/claude -D claude -# Install bun +# Install bun globally for all users RUN curl -fsSL https://bun.sh/install | bash ENV PATH="/root/.bun/bin:${PATH}" ENV BUN_INSTALL="/root/.bun" -# Install Claude Code CLI globally +# Install Claude Code CLI globally and make it accessible to all users RUN bun install -g @anthropic-ai/claude-code@1.0.59 && \ ln -sf /root/.bun/bin/claude /usr/local/bin/claude && \ chmod +x /usr/local/bin/claude && \ + chmod +x /root/.bun/bin/claude && \ echo "Testing claude command..." && \ /usr/local/bin/claude --version +# Ensure the non-root user can also access bun and claude +RUN echo 'export PATH="/root/.bun/bin:$PATH"' >> /home/claude/.bashrc && \ + echo 'export BUN_INSTALL="/root/.bun"' >> /home/claude/.bashrc + # Copy package files COPY package.json ./ COPY tsconfig.json ./ diff --git a/packages/dispatcher/src/kubernetes/job-manager.ts b/packages/dispatcher/src/kubernetes/job-manager.ts index 51c929a07..903db3b73 100644 --- a/packages/dispatcher/src/kubernetes/job-manager.ts +++ b/packages/dispatcher/src/kubernetes/job-manager.ts @@ -468,7 +468,7 @@ export class KubernetesJobManager { }, }, ], - serviceAccountName: "claude-worker", + serviceAccountName: "peerbot", }, }, }, diff --git a/packages/worker/scripts/entrypoint.sh b/packages/worker/scripts/entrypoint.sh index 7f24f7df3..c08eeefe7 100644 --- a/packages/worker/scripts/entrypoint.sh +++ b/packages/worker/scripts/entrypoint.sh @@ -117,7 +117,7 @@ done echo "🤖 Checking Claude CLI installation..." if command -v claude >/dev/null 2>&1; then claude_version=$(timeout 10 claude --version 2>/dev/null || echo "unknown") - echo " ✅ Claude CLI: $version" + echo " ✅ Claude CLI: $claude_version" # Test Claude CLI basic functionality if timeout 10 claude --help >/dev/null 2>&1; then @@ -150,4 +150,4 @@ echo " - Recovery: ${RECOVERY_MODE:-false}" # Start the worker process echo "🚀 Executing Claude Worker..." -exec node /app/dist/index.js \ No newline at end of file +exec bun run dist/index.js \ No newline at end of file From 16df80465e1d91b72091cbb8f14e79fc204ff5ed Mon Sep 17 00:00:00 2001 From: "claude[bot]" <209825114+claude[bot]@users.noreply.github.com> Date: Fri, 15 Aug 2025 14:50:27 +0000 Subject: [PATCH 2/2] fix: Improve Claude CLI PATH accessibility for non-root users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add ENV variables to ensure Claude CLI is accessible to non-root users through both bashrc and container environment, addressing container compatibility issues. Co-authored-by: Burak Emre Kabakcı --- Dockerfile.worker | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile.worker b/Dockerfile.worker index d6fcd553d..d8f3420ae 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -29,9 +29,14 @@ RUN bun install -g @anthropic-ai/claude-code@1.0.59 && \ /usr/local/bin/claude --version # Ensure the non-root user can also access bun and claude +# Add to both bashrc and global environment for broader compatibility RUN echo 'export PATH="/root/.bun/bin:$PATH"' >> /home/claude/.bashrc && \ echo 'export BUN_INSTALL="/root/.bun"' >> /home/claude/.bashrc +# Add environment variables for non-root user access +ENV PATH="/root/.bun/bin:${PATH}" \ + BUN_INSTALL="/root/.bun" + # Copy package files COPY package.json ./ COPY tsconfig.json ./