fix: install claude code CLI in slackbot docker image#1247
Conversation
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>
There was a problem hiding this comment.
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-codeglobally 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 - && \ |
There was a problem hiding this comment.
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.
| 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 && \ |
| 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 |
There was a problem hiding this comment.
[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/bunCheck the official bun releases for the most recent stable version.
| 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 |
| RUN uv sync --extra slackbot --no-dev | ||
| RUN uv sync --extra slackbot --no-dev | ||
|
|
||
| RUN bun install -g @anthropic-ai/claude-code |
There was a problem hiding this comment.
[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.43This ensures consistent behavior across deployments and makes it easier to track which version is being used.
| RUN bun install -g @anthropic-ai/claude-code | |
| RUN bun install -g @anthropic-ai/claude-code@2.0.43 |
summary
fixes the
CLINotFoundErrorthat 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-codeCLI in the docker image.changes
oven/bun:latestimage@anthropic-ai/claude-codeglobally via bun/root/.bun/binto PATH for CLI accessverification
tested in the built image:
error fixed
🤖 Generated with Claude Code