refactor(images): pull from registry instead of building; add build.sh for local dev
This commit is contained in:
parent
ff9ed447c0
commit
2d822305d1
6 changed files with 48 additions and 18 deletions
|
|
@ -1,6 +1,11 @@
|
|||
# Copy this file to .env and fill in your values.
|
||||
# .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) ──────────────────────────────────────────────
|
||||
|
||||
# Option 1: Anthropic API key
|
||||
|
|
|
|||
|
|
@ -44,11 +44,12 @@ docker-claude/
|
|||
## Development Workflow
|
||||
|
||||
```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)
|
||||
cd /path/to/project && ./claude.sh start # build + start proxy + launch Claude (mounts CWD as /workspace)
|
||||
./claude.sh web # build + start proxy + webui (browser terminal on :7681)
|
||||
./claude.sh update # rebuild images (no cache) after upstream updates
|
||||
cd /path/to/project && ./claude.sh start # start proxy + launch Claude (pulls images, mounts CWD)
|
||||
./claude.sh web # start proxy + webui (browser terminal on :7681)
|
||||
./claude.sh update # pull latest images from registry
|
||||
./build.sh # build images locally (development)
|
||||
```
|
||||
|
||||
## Coding Standards
|
||||
|
|
|
|||
16
README.md
16
README.md
|
|
@ -92,11 +92,12 @@ Then run `./claude.sh run` and follow the prompt. Credentials are stored in the
|
|||
### CLI mode
|
||||
|
||||
```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
|
||||
./claude.sh start
|
||||
|
||||
# Start proxy if needed, launch Claude Code (faster on subsequent runs)
|
||||
# Start proxy if needed, launch Claude Code
|
||||
./claude.sh run
|
||||
```
|
||||
|
||||
|
|
@ -123,13 +124,22 @@ sbx ports <sandbox-name> --publish 7681:7681/tcp
|
|||
|
||||
```bash
|
||||
./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 webui # Tail web interface logs
|
||||
./claude.sh status # Show container status
|
||||
./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
|
||||
|
||||
| Mode | Workspace |
|
||||
|
|
|
|||
17
build.sh
Executable file
17
build.sh
Executable 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."
|
||||
16
claude.sh
16
claude.sh
|
|
@ -122,12 +122,8 @@ dc() { docker compose -f "$COMPOSE_FILE" -p "$PROJECT" "$@"; }
|
|||
cmd_start() {
|
||||
check_deps
|
||||
load_env
|
||||
info "Building images..."
|
||||
dc build
|
||||
info "Starting proxy sidecar..."
|
||||
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..."
|
||||
# shellcheck disable=SC2046
|
||||
dc run --rm --service-ports $(workspace_flag) $(kube_flag) claude "$@"
|
||||
|
|
@ -152,8 +148,8 @@ cmd_run() {
|
|||
|
||||
cmd_update() {
|
||||
check_deps
|
||||
info "Rebuilding images (no cache)..."
|
||||
dc build --no-cache
|
||||
info "Pulling latest images from registry..."
|
||||
dc pull
|
||||
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."
|
||||
exit 1
|
||||
fi
|
||||
info "Building images..."
|
||||
dc build
|
||||
info "Starting proxy and web interface..."
|
||||
dc up -d webui
|
||||
local port=7681
|
||||
|
|
@ -206,12 +200,12 @@ cmd_help() {
|
|||
Usage: $(basename "$0") <command> [args]
|
||||
|
||||
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)
|
||||
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)
|
||||
stop Stop and remove all containers
|
||||
update Rebuild images without cache
|
||||
update Pull latest images from the registry
|
||||
logs [svc] Tail logs (default: proxy)
|
||||
status Show container status
|
||||
shell Open a bash shell in the Claude container (debug)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ services:
|
|||
# Bridges the isolated internal network to the internet.
|
||||
# Enforces an egress allowlist — see proxy/squid.conf.
|
||||
proxy:
|
||||
image: registry.zeidler.dev/docker/playground/docker-claude-proxy:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: proxy
|
||||
dockerfile: Dockerfile
|
||||
|
|
@ -24,6 +25,7 @@ services:
|
|||
# No direct internet access. All egress routes through the proxy sidecar.
|
||||
# Run via "docker compose run --rm --service-ports claude" (managed by claude.sh).
|
||||
claude:
|
||||
image: registry.zeidler.dev/docker/playground/docker-claude-claude:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: claude/
|
||||
dockerfile: Dockerfile
|
||||
|
|
@ -64,6 +66,7 @@ services:
|
|||
# Protected by HTTP basic auth — set WEBUI_USER / WEBUI_PASSWORD in .env.
|
||||
# Network isolation is identical to the CLI container.
|
||||
webui:
|
||||
image: registry.zeidler.dev/docker/playground/docker-claude-claude:${IMAGE_TAG:-latest}
|
||||
build:
|
||||
context: claude/
|
||||
dockerfile: Dockerfile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue