Skip to content

fix: install claude code CLI in slackbot docker image#1247

Merged
zzstoatzz merged 1 commit intomainfrom
fix/install-claude-code-in-slackbot-docker
Nov 18, 2025
Merged

fix: install claude code CLI in slackbot docker image#1247
zzstoatzz merged 1 commit intomainfrom
fix/install-claude-code-in-slackbot-docker

Conversation

@zzstoatzz
Copy link
Copy Markdown
Collaborator

summary

fixes the CLINotFoundError that occurs when the slackbot's research agent tries to use the claude agent SDK. PR #1244 integrated the SDK but didn't install the required @anthropic-ai/claude-code CLI in the docker image.

changes

  • copy bun binary from official oven/bun:latest image
  • install nodejs 20.x from nodesource (required by claude CLI)
  • install @anthropic-ai/claude-code globally via bun
  • add /root/.bun/bin to PATH for CLI access

verification

tested in the built image:

$ docker run --rm marvin-slackbot claude --version
2.0.43 (Claude Code)

$ docker run --rm marvin-slackbot which claude
/root/.bun/bin/claude

error fixed

CLINotFoundError: Claude Code not found. Install with:
  npm install -g @anthropic-ai/claude-code

🤖 Generated with Claude Code

adds bun and nodejs to the docker image to support the claude agent sdk's
CLI dependency. the SDK requires the @anthropic-ai/claude-code package
which we install globally with bun and add to PATH.

changes:
- copy bun binary from official oven/bun image
- install nodejs 20.x from nodesource
- install @anthropic-ai/claude-code globally via bun
- add /root/.bun/bin to PATH for CLI access

fixes the CLINotFoundError when research_agent.py tries to use ClaudeSDKClient

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings November 18, 2025 02:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a CLINotFoundError that occurs when the slackbot's research agent attempts to use the Claude Agent SDK. The fix installs the required @anthropic-ai/claude-code CLI tool in the Docker image.

Key Changes:

  • Added bun runtime to the Docker image for installing and running the Claude CLI
  • Installed Node.js 20.x as a dependency for the Claude CLI
  • Installed @anthropic-ai/claude-code globally and configured PATH access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


RUN apt-get update && \
apt-get install -y git build-essential curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Piping curl output directly to bash is a security anti-pattern. Consider downloading the script first, verifying it, then executing it:

RUN curl -fsSL https://deb.nodesource.com/setup_20.x -o setup_node.sh && \
    bash setup_node.sh && \
    rm setup_node.sh && \
    apt-get install -y nodejs && \

Alternatively, if the @anthropic-ai/claude-code CLI doesn't have a hard runtime dependency on Node.js, consider whether you can use bun alone without installing Node.js, which would simplify the image.

Suggested change
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
curl -fsSL https://deb.nodesource.com/setup_20.x -o setup_node.sh && \
bash setup_node.sh && \
rm setup_node.sh && \

Copilot uses AI. Check for mistakes.
FROM python:3.13-slim

COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY --from=oven/bun:latest /usr/local/bin/bun /usr/local/bin/bun
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using the latest tag for the base image can lead to non-reproducible builds. Consider pinning to a specific version:

COPY --from=oven/bun:1.1.38 /usr/local/bin/bun /usr/local/bin/bun

Check the official bun releases for the most recent stable version.

Suggested change
COPY --from=oven/bun:latest /usr/local/bin/bun /usr/local/bin/bun
COPY --from=oven/bun:1.1.38 /usr/local/bin/bun /usr/local/bin/bun

Copilot uses AI. Check for mistakes.
RUN uv sync --extra slackbot --no-dev
RUN uv sync --extra slackbot --no-dev

RUN bun install -g @anthropic-ai/claude-code
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider pinning the @anthropic-ai/claude-code package to a specific version for reproducible builds:

RUN bun install -g @anthropic-ai/claude-code@2.0.43

This ensures consistent behavior across deployments and makes it easier to track which version is being used.

Suggested change
RUN bun install -g @anthropic-ai/claude-code
RUN bun install -g @anthropic-ai/claude-code@2.0.43

Copilot uses AI. Check for mistakes.
@zzstoatzz zzstoatzz merged commit 2054977 into main Nov 18, 2025
9 checks passed
@zzstoatzz zzstoatzz deleted the fix/install-claude-code-in-slackbot-docker branch November 18, 2025 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants