From 441064b1bf00e5117ecb7f0932ee7ee0af6ff049 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 30 Nov 2025 04:13:14 +0000 Subject: [PATCH] feat: auto-update Dockerfile with current claude-code npm version - 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 --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 2 +- .../workflows/update-devcontainer-version.yml | 62 +++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/update-devcontainer-version.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8b48f6ad7..8f5f5592a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ FROM node:20 ARG TZ ENV TZ="$TZ" -ARG CLAUDE_CODE_VERSION=latest +ARG CLAUDE_CODE_VERSION=2.0.55 # Install basic development tools and iptables/ipset RUN apt-get update && apt-get install -y --no-install-recommends \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7f6a172d1..571ee5105 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "dockerfile": "Dockerfile", "args": { "TZ": "${localEnv:TZ:America/Los_Angeles}", - "CLAUDE_CODE_VERSION": "latest", + "CLAUDE_CODE_VERSION": "2.0.55", "GIT_DELTA_VERSION": "0.18.2", "ZSH_IN_DOCKER_VERSION": "1.2.0" } diff --git a/.github/workflows/update-devcontainer-version.yml b/.github/workflows/update-devcontainer-version.yml new file mode 100644 index 000000000..137636d59 --- /dev/null +++ b/.github/workflows/update-devcontainer-version.yml @@ -0,0 +1,62 @@ +name: Update DevContainer Claude Code Version + +on: + schedule: + # Run daily at 00:00 UTC + - cron: '0 0 * * *' + workflow_dispatch: # Allow manual trigger + +jobs: + update-version: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + + - name: Get latest npm version + id: npm-version + run: | + LATEST_VERSION=$(npm view @anthropic-ai/claude-code version) + echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT + echo "Latest npm version: $LATEST_VERSION" + + - name: Get current version from Dockerfile + id: current-version + run: | + CURRENT_VERSION=$(grep -oP 'ARG CLAUDE_CODE_VERSION=\K[^\s]+' .devcontainer/Dockerfile) + echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT + echo "Current version: $CURRENT_VERSION" + + - name: Update version if changed + if: steps.npm-version.outputs.version != steps.current-version.outputs.version + run: | + NEW_VERSION="${{ steps.npm-version.outputs.version }}" + + # Update Dockerfile + sed -i "s/ARG CLAUDE_CODE_VERSION=.*/ARG CLAUDE_CODE_VERSION=$NEW_VERSION/" .devcontainer/Dockerfile + + # Update devcontainer.json + sed -i "s/\"CLAUDE_CODE_VERSION\": \".*\"/\"CLAUDE_CODE_VERSION\": \"$NEW_VERSION\"/" .devcontainer/devcontainer.json + + echo "Updated version to $NEW_VERSION" + + - name: Create Pull Request + if: steps.npm-version.outputs.version != steps.current-version.outputs.version + uses: peter-evans/create-pull-request@v7 + with: + commit-message: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}" + title: "chore: update devcontainer claude-code to v${{ steps.npm-version.outputs.version }}" + body: | + This PR automatically updates the claude-code version in the devcontainer configuration. + + **Changes:** + - Updated `CLAUDE_CODE_VERSION` from `${{ steps.current-version.outputs.version }}` to `${{ steps.npm-version.outputs.version }}` + + This ensures Docker cache is invalidated when rebuilding images, allowing users to get the latest claude-code version. + + Related: #582 + branch: chore/update-claude-code-version + delete-branch: true