Switch to native Claude Code installer and add update command

Replace the deprecated npm installation with the native installer. The
binary is installed to /usr/local/bin so it survives the home directory
bind mount at runtime.

Add a 'claude update' subcommand that rebuilds the image with the latest
Claude Code binary and removes all existing containers.

Disable the in-container auto-updater since the binary lives in the
read-only image layer.
This commit is contained in:
Jeena 2026-03-18 03:53:55 +00:00
parent bfcb79a890
commit 4605a62d90
3 changed files with 64 additions and 2 deletions

View file

@ -13,13 +13,22 @@ RUN pacman -Syu --noconfirm \
ripgrep \
nodejs \
npm \
curl \
sudo && \
groupadd -g ${GID} ${USERNAME} && \
useradd -m -u ${UID} -g ${GID} -s /bin/bash ${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
npm install -g @anthropic-ai/claude-code && \
pacman -Scc --noconfirm
# Install Claude Code using the native installer, then copy the binary
# to a system-wide location so it survives the home directory bind mount
USER ${USERNAME}
WORKDIR /tmp
RUN curl -fsSL https://claude.ai/install.sh | bash && \
sudo cp ~/.local/bin/claude /usr/local/bin/claude && \
rm -rf ~/.local/share/claude ~/.local/bin/claude ~/.claude ~/.claude.json \
~/.cache/claude
USER ${USERNAME}
WORKDIR /home/${USERNAME}