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
This commit is contained in:
Claude
2025-11-30 04:13:14 +00:00
parent 84d7b08539
commit 441064b1bf
3 changed files with 64 additions and 2 deletions

View File

@@ -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 \

View File

@@ -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"
}

View File

@@ -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