refactor(images): pull from registry instead of building; add build.sh for local dev

This commit is contained in:
docker-claude 2026-04-15 17:02:43 +02:00
parent ff9ed447c0
commit 2d822305d1
6 changed files with 48 additions and 18 deletions

View file

@ -1,6 +1,11 @@
# Copy this file to .env and fill in your values. # Copy this file to .env and fill in your values.
# .env is git-ignored — never commit it. # .env is git-ignored — never commit it.
# ─── Image version ────────────────────────────────────────────────────────────
# Pin to a specific image tag. Defaults to "latest" if unset.
# IMAGE_TAG=0.1.42
# ─── Authentication (choose one) ────────────────────────────────────────────── # ─── Authentication (choose one) ──────────────────────────────────────────────
# Option 1: Anthropic API key # Option 1: Anthropic API key

View file

@ -44,11 +44,12 @@ docker-claude/
## Development Workflow ## Development Workflow
```bash ```bash
chmod +x claude.sh chmod +x claude.sh build.sh
cp .env.example .env # set ANTHROPIC_API_KEY (and WEBUI_PASSWORD for web mode) cp .env.example .env # set ANTHROPIC_API_KEY (and WEBUI_PASSWORD for web mode)
cd /path/to/project && ./claude.sh start # build + start proxy + launch Claude (mounts CWD as /workspace) cd /path/to/project && ./claude.sh start # start proxy + launch Claude (pulls images, mounts CWD)
./claude.sh web # build + start proxy + webui (browser terminal on :7681) ./claude.sh web # start proxy + webui (browser terminal on :7681)
./claude.sh update # rebuild images (no cache) after upstream updates ./claude.sh update # pull latest images from registry
./build.sh # build images locally (development)
``` ```
## Coding Standards ## Coding Standards

View file

@ -92,11 +92,12 @@ Then run `./claude.sh run` and follow the prompt. Credentials are stored in the
### CLI mode ### CLI mode
```bash ```bash
# Build images, start proxy, launch Claude Code in the current directory # Start proxy, launch Claude Code in the current directory
# (pulls images from registry.zeidler.dev on first run)
cd ~/myproject cd ~/myproject
./claude.sh start ./claude.sh start
# Start proxy if needed, launch Claude Code (faster on subsequent runs) # Start proxy if needed, launch Claude Code
./claude.sh run ./claude.sh run
``` ```
@ -123,13 +124,22 @@ sbx ports <sandbox-name> --publish 7681:7681/tcp
```bash ```bash
./claude.sh stop # Stop and remove all containers ./claude.sh stop # Stop and remove all containers
./claude.sh update # Rebuild images without cache ./claude.sh update # Pull latest images from the registry
./claude.sh logs # Tail proxy logs ./claude.sh logs # Tail proxy logs
./claude.sh logs webui # Tail web interface logs ./claude.sh logs webui # Tail web interface logs
./claude.sh status # Show container status ./claude.sh status # Show container status
./claude.sh shell # Debug bash shell in the Claude container ./claude.sh shell # Debug bash shell in the Claude container
``` ```
### Building locally
`build.sh` builds both images from source using the local Dockerfiles:
```bash
./build.sh # build with layer cache
./build.sh --no-cache # force full rebuild
```
### Workspace ### Workspace
| Mode | Workspace | | Mode | Workspace |

17
build.sh Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
# build.sh — Build Docker images locally for development
# Usage: ./build.sh [--no-cache] [--push]
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COMPOSE_FILE="$SCRIPT_DIR/docker-compose.yml"
PROJECT="claude-secure"
GREEN='\033[0;32m'; NC='\033[0m'
info() { echo -e "${GREEN}[+]${NC} $*"; }
dc() { docker compose -f "$COMPOSE_FILE" -p "$PROJECT" "$@"; }
info "Building images..."
dc build "$@"
info "Done. Run './claude.sh start' to launch."

View file

@ -122,12 +122,8 @@ dc() { docker compose -f "$COMPOSE_FILE" -p "$PROJECT" "$@"; }
cmd_start() { cmd_start() {
check_deps check_deps
load_env load_env
info "Building images..."
dc build
info "Starting proxy sidecar..." info "Starting proxy sidecar..."
dc up -d proxy dc up -d proxy
info "Waiting for proxy health check..."
dc up -d proxy # no-op if already healthy; compose waits via depends_on
info "Launching Claude Code..." info "Launching Claude Code..."
# shellcheck disable=SC2046 # shellcheck disable=SC2046
dc run --rm --service-ports $(workspace_flag) $(kube_flag) claude "$@" dc run --rm --service-ports $(workspace_flag) $(kube_flag) claude "$@"
@ -152,8 +148,8 @@ cmd_run() {
cmd_update() { cmd_update() {
check_deps check_deps
info "Rebuilding images (no cache)..." info "Pulling latest images from registry..."
dc build --no-cache dc pull
info "Update complete. Run './claude.sh start' to launch." info "Update complete. Run './claude.sh start' to launch."
} }
@ -183,8 +179,6 @@ cmd_web() {
error "WEBUI_PASSWORD is not set. Add it to .env before starting the web interface." error "WEBUI_PASSWORD is not set. Add it to .env before starting the web interface."
exit 1 exit 1
fi fi
info "Building images..."
dc build
info "Starting proxy and web interface..." info "Starting proxy and web interface..."
dc up -d webui dc up -d webui
local port=7681 local port=7681
@ -206,12 +200,12 @@ cmd_help() {
Usage: $(basename "$0") <command> [args] Usage: $(basename "$0") <command> [args]
Commands: Commands:
start [args] Build images, start proxy, launch Claude Code (CLI) start [args] Start proxy, launch Claude Code (CLI)
run [args] Start proxy if needed, launch Claude Code (CLI) run [args] Start proxy if needed, launch Claude Code (CLI)
web Build images, start proxy + web interface (browser terminal) web Start proxy + web interface (browser terminal)
web-stop Stop the web interface (keeps proxy running) web-stop Stop the web interface (keeps proxy running)
stop Stop and remove all containers stop Stop and remove all containers
update Rebuild images without cache update Pull latest images from the registry
logs [svc] Tail logs (default: proxy) logs [svc] Tail logs (default: proxy)
status Show container status status Show container status
shell Open a bash shell in the Claude container (debug) shell Open a bash shell in the Claude container (debug)

View file

@ -3,6 +3,7 @@ services:
# Bridges the isolated internal network to the internet. # Bridges the isolated internal network to the internet.
# Enforces an egress allowlist — see proxy/squid.conf. # Enforces an egress allowlist — see proxy/squid.conf.
proxy: proxy:
image: registry.zeidler.dev/docker/playground/docker-claude-proxy:${IMAGE_TAG:-latest}
build: build:
context: proxy context: proxy
dockerfile: Dockerfile dockerfile: Dockerfile
@ -24,6 +25,7 @@ services:
# No direct internet access. All egress routes through the proxy sidecar. # No direct internet access. All egress routes through the proxy sidecar.
# Run via "docker compose run --rm --service-ports claude" (managed by claude.sh). # Run via "docker compose run --rm --service-ports claude" (managed by claude.sh).
claude: claude:
image: registry.zeidler.dev/docker/playground/docker-claude-claude:${IMAGE_TAG:-latest}
build: build:
context: claude/ context: claude/
dockerfile: Dockerfile dockerfile: Dockerfile
@ -64,6 +66,7 @@ services:
# Protected by HTTP basic auth — set WEBUI_USER / WEBUI_PASSWORD in .env. # Protected by HTTP basic auth — set WEBUI_USER / WEBUI_PASSWORD in .env.
# Network isolation is identical to the CLI container. # Network isolation is identical to the CLI container.
webui: webui:
image: registry.zeidler.dev/docker/playground/docker-claude-claude:${IMAGE_TAG:-latest}
build: build:
context: claude/ context: claude/
dockerfile: Dockerfile dockerfile: Dockerfile