spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

feat: auto-update Dockerfile with current claude-code npm versionBrowse files
- Add GitHub workflow to automatically check for new claude-code versions daily
- Pin CLAUDE_CODE_VERSION to 2.0.55 (instead of 'latest') in Dockerfile and devcontainer.json
- Workflow creates PRs when new versions are available, ensuring Docker cache invalidation

Fixes #582
Claude authored on Nov 30, 2025 parent 84d7b08 · commit 441064b1bf00
3 changed files+64 -2compared with 84d7b08
M.devcontainer/Dockerfile
M.devcontainer/devcontainer.json
A.github/workflows/update-devcontainer-version.yml
@@ -3,7 +3,7 @@
33 ARG TZ
44 ENV TZ="$TZ"
55
6-ARG CLAUDE_CODE_VERSION=latest
6+ARG CLAUDE_CODE_VERSION=2.0.55
77
88 # Install basic development tools and iptables/ipset
99 RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -4,7 +4,7 @@
44 "dockerfile": "Dockerfile",
55 "args": {
66 "TZ": "${localEnv:TZ:America/Los_Angeles}",
7- "CLAUDE_CODE_VERSION": "latest",
7+ "CLAUDE_CODE_VERSION": "2.0.55",
88 "GIT_DELTA_VERSION": "0.18.2",
99 "ZSH_IN_DOCKER_VERSION": "1.2.0"
1010 }
@@ -1,0 +1,62 @@
1+name: Update DevContainer Claude Code Version
2+
3+on:
4+ schedule:
5+ # Run daily at 00:00 UTC
6+ - cron: '0 0 * * *'
7+ workflow_dispatch: # Allow manual trigger
8+
9+jobs:
10+ update-version:
11+ runs-on: ubuntu-latest
12+ permissions:
13+ contents: write
14+ pull-requests: write
15+ steps:
16+ - name: Checkout repository
17+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18+
19+ - name: Get latest npm version
20+ id: npm-version
21+ run: |
22+ LATEST_VERSION=$(npm view @anthropic-ai/claude-code version)
23+ echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT
24+ echo "Latest npm version: $LATEST_VERSION"
25+
26+ - name: Get current version from Dockerfile
27+ id: current-version
28+ run: |
29+ CURRENT_VERSION=$(grep -oP 'ARG CLAUDE_CODE_VERSION=\K[^\s]+' .devcontainer/Dockerfile)
30+ echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
31+ echo "Current version: $CURRENT_VERSION"
32+
33+ - name: Update version if changed
34+ if: steps.npm-version.outputs.version != steps.current-version.outputs.version
35+ run: |
36+ NEW_VERSION="${{ steps.npm-version.outputs.version }}"
37+
38+ # Update Dockerfile
39+ sed -i "s/ARG CLAUDE_CODE_VERSION=.*/ARG CLAUDE_CODE_VERSION=$NEW_VERSION/" .devcontainer/Dockerfile
40+
41+ # Update devcontainer.json
42+ sed -i "s/\"CLAUDE_CODE_VERSION\": \".*\"/\"CLAUDE_CODE_VERSION\": \"$NEW_VERSION\"/" .devcontainer/devcontainer.json
43+
44+ echo "Updated version to $NEW_VERSION"
45+
46+ - name: Create Pull Request
47+ if: steps.npm-version.outputs.version != steps.current-version.outputs.version
48+ uses: peter-evans/create-pull-request@v7
49+ with:
50+ commit-message: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}"
51+ title: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}"
52+ body: |
53+ This PR automatically updates the claude-code version in the devcontainer configuration.
54+
55+ **Changes:**
56+ - Updated `CLAUDE_CODE_VERSION` from `${{ steps.current-version.outputs.version }}` to `${{ steps.npm-version.outputs.version }}`
57+
58+ This ensures Docker cache is invalidated when rebuilding images, allowing users to get the latest claude-code version.
59+
60+ Related: #582
61+ branch: chore/update-claude-code-version
62+ delete-branch: true