Skip to content

Commit ebefad1

Browse files
gatezhclaude
andcommitted
feat(ci): smart cache busting for daily rebuilds
- Add CACHE_BUST build arg before Claude Code install — layers above (system packages, Playwright) stay cached, layers below (Claude Code, agent-browser) rebuild fresh on schedule/dispatch - Move AGENT_BROWSER_VERSION to default stage, default to latest - Add no-cache checkbox to workflow_dispatch UI - Add claude-code to main README - Update claude-code README with rebuild docs and version changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9b36c3e commit ebefad1

4 files changed

Lines changed: 39 additions & 4 deletions

File tree

‎.github/workflows/build-claude-code.yml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
schedule:
99
- cron: '0 11 * * *'
1010
workflow_dispatch:
11+
inputs:
12+
no-cache:
13+
description: 'Full rebuild without Docker cache'
14+
type: boolean
15+
default: false
1116

1217
permissions:
1318
contents: read
@@ -76,7 +81,9 @@ jobs:
7681
push: true
7782
tags: ${{ steps.meta.outputs.tags }}
7883
labels: ${{ steps.meta.outputs.labels }}
79-
no-cache: ${{ github.event_name != 'push' }}
84+
build-args: |
85+
CACHE_BUST=${{ github.event_name != 'push' && github.run_id || 'stable' }}
86+
no-cache: ${{ inputs.no-cache == true }}
8087
cache-from: type=gha,scope=${{ matrix.target }}
8188
cache-to: type=gha,mode=max,scope=${{ matrix.target }}
8289

‎README.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This repository contains Dockerfiles for custom Docker images hosted on GitHub C
66

77
### Devcontainer Images
88

9+
- **[claude-code](./claude-code/README.md)** - Shared Claude Code devcontainer image (default + sandbox variants)
910
- **[devcontainer-bun](./devcontainer-bun/README.md)** - Bun development container
1011
- **[devcontainer-claude-bun](./devcontainer-claude-bun/README.md)** - Claude Code development container with firewall sandbox
1112
- **[devcontainer-hugo-bun](./devcontainer-hugo-bun/README.md)** - Hugo Extended + Bun development container
@@ -36,6 +37,27 @@ image-name/
3637

3738
## Available Images
3839

40+
### claude-code
41+
42+
Shared devcontainer base image for Claude Code projects. Two variants from a single multi-stage Dockerfile: **default** (full dev environment with agent-browser) and **sandbox** (network-restricted with iptables firewall). Projects consume pre-built images and control tool versions via `.mise.toml`. Rebuilds daily to pick up latest Claude Code.
43+
44+
**Usage in other projects:**
45+
46+
```jsonc
47+
// Default variant
48+
{
49+
"image": "ghcr.io/gatezh/devcontainer-images/claude-code:latest"
50+
}
51+
52+
// Sandbox variant
53+
{
54+
"image": "ghcr.io/gatezh/devcontainer-images/claude-code-sandbox:latest",
55+
"capAdd": ["NET_ADMIN", "NET_RAW"]
56+
}
57+
```
58+
59+
See the [claude-code README](./claude-code/README.md) for full setup guide.
60+
3961
### devcontainer-bun
4062

4163
Bun development container for modern JavaScript/TypeScript development.

‎claude-code/.devcontainer/Dockerfile‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ FROM node:22-trixie-slim AS base
1616

1717
ARG GIT_DELTA_VERSION=0.18.2
1818
ARG PLAYWRIGHT_VERSION=1.58.2
19-
ARG AGENT_BROWSER_VERSION=0.14.0
2019

2120
# System packages shared by all targets
2221
# - ca-certificates: SSL/TLS for HTTPS connections
@@ -120,6 +119,12 @@ RUN npx -y playwright@${PLAYWRIGHT_VERSION} install-deps chromium
120119
USER node
121120
RUN npx -y playwright@${PLAYWRIGHT_VERSION} install --only-shell
122121

122+
# ── Cache bust ────────────────────────────────────────────────────────────────
123+
# Layers above (system packages, Playwright, etc.) stay cached for speed.
124+
# Layers below (Claude Code, agent-browser) rebuild when CACHE_BUST changes,
125+
# picking up the latest versions on daily scheduled builds.
126+
ARG CACHE_BUST=stable
127+
123128
# ── Claude Code CLI (native installer) ───────────────────────────────────────
124129
# Native installer replaces deprecated npm method (npm install -g @anthropic-ai/claude-code)
125130
# See: https://code.claude.com/docs/en/getting-started
@@ -151,6 +156,7 @@ USER node
151156
# agent-browser: headless browser automation for AI agents
152157
# Installs its own bundled playwright-core + full chromium (separate from Playwright above)
153158
# Requires root for system deps (apt-get install triggered by --with-deps)
159+
ARG AGENT_BROWSER_VERSION=latest
154160
USER root
155161
RUN npm install -g agent-browser@${AGENT_BROWSER_VERSION} \
156162
&& $(npm root -g)/agent-browser/node_modules/.bin/playwright-core install --with-deps chromium \

‎claude-code/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Both variants are built for:
4040

4141
## Automatic Rebuilds
4242

43-
The image rebuilds daily at 5am MT (11:00 UTC) with no Docker cache, picking up the latest Claude Code, Playwright, and other tools. Manual rebuilds can be triggered via the "Run workflow" button in the Actions UI.
43+
The image rebuilds daily at 5am MT (11:00 UTC). Cached layers (system packages, Playwright) are reused for speed, while Claude Code and agent-browser always install fresh via a cache-busting build arg. Manual rebuilds can be triggered via the "Run workflow" button in the Actions UI.
4444

4545
## Quick Start
4646

@@ -225,7 +225,7 @@ The image bakes in a Playwright browser binary at a specific version (controlled
225225
|-----|---------|-------------|
226226
| `GIT_DELTA_VERSION` | `0.18.2` | git-delta version |
227227
| `PLAYWRIGHT_VERSION` | `1.58.2` | Playwright browser binary version |
228-
| `AGENT_BROWSER_VERSION` | `0.14.0` | agent-browser version (default target only) |
228+
| `AGENT_BROWSER_VERSION` | `latest` | agent-browser version (default target only) |
229229

230230
## Building Locally
231231

0 commit comments

Comments
 (0)