Skip to content

Commit 8aab9e3

Browse files
authored
feat: include inspector UI in release binaries (#34)
## Summary - Add Node.js build stage to all release Dockerfiles to build the inspector frontend - Copy pre-built inspector assets into Rust build stages so they get embedded in binaries - Remove `SANDBOX_AGENT_SKIP_INSPECTOR=1` from all Dockerfiles and the release workflow ## Test plan - [ ] Build linux-x86_64 locally: `docker/release/build.sh x86_64-unknown-linux-musl` - [ ] Run the binary and verify inspector is embedded (should show "inspector ui available") - [ ] Access the inspector UI at http://localhost:2468/ui/ 🤖 Generated with [Claude Code](https://claude.ai/code)
1 parent 394945f commit 8aab9e3

File tree

6 files changed

+150
-12
lines changed

6 files changed

+150
-12
lines changed

.github/workflows/release.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ defaults:
2525
env:
2626
# Disable incremental compilation for faster from-scratch builds
2727
CARGO_INCREMENTAL: 0
28-
# Skip inspector frontend for CI (not needed for type checking)
29-
SANDBOX_AGENT_SKIP_INSPECTOR: 1
3028
# Skip OpenAPI generation in CI (use pre-committed docs/openapi.json)
3129
SKIP_OPENAPI_GEN: 1
3230

docker/release/linux-x86_64.Dockerfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
# syntax=docker/dockerfile:1.10.0
2+
3+
# Build inspector frontend
4+
FROM node:22-alpine AS inspector-build
5+
WORKDIR /app
6+
RUN npm install -g pnpm
7+
8+
# Copy package files for workspaces
9+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10+
COPY frontend/packages/inspector/package.json ./frontend/packages/inspector/
11+
COPY sdks/typescript/package.json ./sdks/typescript/
12+
13+
# Install dependencies
14+
RUN pnpm install --filter @anthropic-ai/sdk-inspector...
15+
16+
# Copy SDK source (with pre-generated types from docs/openapi.json)
17+
COPY docs/openapi.json ./docs/
18+
COPY sdks/typescript ./sdks/typescript
19+
20+
# Build SDK (just tsup, skip generate since types are pre-generated)
21+
RUN cd sdks/typescript && SKIP_OPENAPI_GEN=1 pnpm exec tsup
22+
23+
# Copy inspector source and build
24+
COPY frontend/packages/inspector ./frontend/packages/inspector
25+
RUN cd frontend/packages/inspector && pnpm exec vite build
26+
227
FROM rust:1.88.0 AS base
328

429
# Install dependencies
@@ -61,12 +86,14 @@ ENV OPENSSL_DIR=/musl \
6186
# Copy the source code
6287
COPY . .
6388

89+
# Copy pre-built inspector frontend
90+
COPY --from=inspector-build /app/frontend/packages/inspector/dist ./frontend/packages/inspector/dist
91+
6492
# Build for Linux with musl (static binary) - x86_64
65-
# SANDBOX_AGENT_SKIP_INSPECTOR=1 skips embedding the inspector frontend
6693
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6794
--mount=type=cache,target=/usr/local/cargo/git \
6895
--mount=type=cache,target=/build/target \
69-
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent --release --target x86_64-unknown-linux-musl && \
96+
cargo build -p sandbox-agent --release --target x86_64-unknown-linux-musl && \
7097
mkdir -p /artifacts && \
7198
cp target/x86_64-unknown-linux-musl/release/sandbox-agent /artifacts/sandbox-agent-x86_64-unknown-linux-musl
7299

docker/release/macos-aarch64.Dockerfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
# syntax=docker/dockerfile:1.10.0
2+
3+
# Build inspector frontend
4+
FROM node:22-alpine AS inspector-build
5+
WORKDIR /app
6+
RUN npm install -g pnpm
7+
8+
# Copy package files for workspaces
9+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10+
COPY frontend/packages/inspector/package.json ./frontend/packages/inspector/
11+
COPY sdks/typescript/package.json ./sdks/typescript/
12+
13+
# Install dependencies
14+
RUN pnpm install --filter @anthropic-ai/sdk-inspector...
15+
16+
# Copy SDK source (with pre-generated types from docs/openapi.json)
17+
COPY docs/openapi.json ./docs/
18+
COPY sdks/typescript ./sdks/typescript
19+
20+
# Build SDK (just tsup, skip generate since types are pre-generated)
21+
RUN cd sdks/typescript && SKIP_OPENAPI_GEN=1 pnpm exec tsup
22+
23+
# Copy inspector source and build
24+
COPY frontend/packages/inspector ./frontend/packages/inspector
25+
RUN cd frontend/packages/inspector && pnpm exec vite build
26+
227
FROM rust:1.88.0 AS base
328

429
# Install dependencies
@@ -59,12 +84,14 @@ ar = "aarch64-apple-darwin20.4-ar"\n\
5984
# Copy the source code
6085
COPY . .
6186

87+
# Copy pre-built inspector frontend
88+
COPY --from=inspector-build /app/frontend/packages/inspector/dist ./frontend/packages/inspector/dist
89+
6290
# Build for ARM64 macOS
63-
# SANDBOX_AGENT_SKIP_INSPECTOR=1 skips embedding the inspector frontend
6491
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6592
--mount=type=cache,target=/usr/local/cargo/git \
6693
--mount=type=cache,target=/build/target \
67-
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent --release --target aarch64-apple-darwin && \
94+
cargo build -p sandbox-agent --release --target aarch64-apple-darwin && \
6895
mkdir -p /artifacts && \
6996
cp target/aarch64-apple-darwin/release/sandbox-agent /artifacts/sandbox-agent-aarch64-apple-darwin
7097

docker/release/macos-x86_64.Dockerfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
# syntax=docker/dockerfile:1.10.0
2+
3+
# Build inspector frontend
4+
FROM node:22-alpine AS inspector-build
5+
WORKDIR /app
6+
RUN npm install -g pnpm
7+
8+
# Copy package files for workspaces
9+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10+
COPY frontend/packages/inspector/package.json ./frontend/packages/inspector/
11+
COPY sdks/typescript/package.json ./sdks/typescript/
12+
13+
# Install dependencies
14+
RUN pnpm install --filter @anthropic-ai/sdk-inspector...
15+
16+
# Copy SDK source (with pre-generated types from docs/openapi.json)
17+
COPY docs/openapi.json ./docs/
18+
COPY sdks/typescript ./sdks/typescript
19+
20+
# Build SDK (just tsup, skip generate since types are pre-generated)
21+
RUN cd sdks/typescript && SKIP_OPENAPI_GEN=1 pnpm exec tsup
22+
23+
# Copy inspector source and build
24+
COPY frontend/packages/inspector ./frontend/packages/inspector
25+
RUN cd frontend/packages/inspector && pnpm exec vite build
26+
227
FROM rust:1.88.0 AS base
328

429
# Install dependencies
@@ -59,12 +84,14 @@ ar = "x86_64-apple-darwin20.4-ar"\n\
5984
# Copy the source code
6085
COPY . .
6186

87+
# Copy pre-built inspector frontend
88+
COPY --from=inspector-build /app/frontend/packages/inspector/dist ./frontend/packages/inspector/dist
89+
6290
# Build for x86_64 macOS
63-
# SANDBOX_AGENT_SKIP_INSPECTOR=1 skips embedding the inspector frontend
6491
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6592
--mount=type=cache,target=/usr/local/cargo/git \
6693
--mount=type=cache,target=/build/target \
67-
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent --release --target x86_64-apple-darwin && \
94+
cargo build -p sandbox-agent --release --target x86_64-apple-darwin && \
6895
mkdir -p /artifacts && \
6996
cp target/x86_64-apple-darwin/release/sandbox-agent /artifacts/sandbox-agent-x86_64-apple-darwin
7097

docker/release/windows.Dockerfile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
# syntax=docker/dockerfile:1.10.0
2+
3+
# Build inspector frontend
4+
FROM node:22-alpine AS inspector-build
5+
WORKDIR /app
6+
RUN npm install -g pnpm
7+
8+
# Copy package files for workspaces
9+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
10+
COPY frontend/packages/inspector/package.json ./frontend/packages/inspector/
11+
COPY sdks/typescript/package.json ./sdks/typescript/
12+
13+
# Install dependencies
14+
RUN pnpm install --filter @anthropic-ai/sdk-inspector...
15+
16+
# Copy SDK source (with pre-generated types from docs/openapi.json)
17+
COPY docs/openapi.json ./docs/
18+
COPY sdks/typescript ./sdks/typescript
19+
20+
# Build SDK (just tsup, skip generate since types are pre-generated)
21+
RUN cd sdks/typescript && SKIP_OPENAPI_GEN=1 pnpm exec tsup
22+
23+
# Copy inspector source and build
24+
COPY frontend/packages/inspector ./frontend/packages/inspector
25+
RUN cd frontend/packages/inspector && pnpm exec vite build
26+
227
FROM rust:1.88.0
328

429
# Install dependencies
@@ -45,12 +70,14 @@ WORKDIR /build
4570
# Copy the source code
4671
COPY . .
4772

73+
# Copy pre-built inspector frontend
74+
COPY --from=inspector-build /app/frontend/packages/inspector/dist ./frontend/packages/inspector/dist
75+
4876
# Build for Windows
49-
# SANDBOX_AGENT_SKIP_INSPECTOR=1 skips embedding the inspector frontend
5077
RUN --mount=type=cache,target=/usr/local/cargo/registry \
5178
--mount=type=cache,target=/usr/local/cargo/git \
5279
--mount=type=cache,target=/build/target \
53-
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent --release --target x86_64-pc-windows-gnu && \
80+
cargo build -p sandbox-agent --release --target x86_64-pc-windows-gnu && \
5481
mkdir -p /artifacts && \
5582
cp target/x86_64-pc-windows-gnu/release/sandbox-agent.exe /artifacts/sandbox-agent-x86_64-pc-windows-gnu.exe
5683

docker/runtime/Dockerfile

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
# syntax=docker/dockerfile:1.10.0
22

3+
# ============================================================================
4+
# Build inspector frontend
5+
# ============================================================================
6+
FROM node:22-alpine AS inspector-build
7+
WORKDIR /app
8+
RUN npm install -g pnpm
9+
10+
# Copy package files for workspaces
11+
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
12+
COPY frontend/packages/inspector/package.json ./frontend/packages/inspector/
13+
COPY sdks/typescript/package.json ./sdks/typescript/
14+
15+
# Install dependencies
16+
RUN pnpm install --filter @anthropic-ai/sdk-inspector...
17+
18+
# Copy SDK source (with pre-generated types from docs/openapi.json)
19+
COPY docs/openapi.json ./docs/
20+
COPY sdks/typescript ./sdks/typescript
21+
22+
# Build SDK (just tsup, skip generate since types are pre-generated)
23+
RUN cd sdks/typescript && SKIP_OPENAPI_GEN=1 pnpm exec tsup
24+
25+
# Copy inspector source and build
26+
COPY frontend/packages/inspector ./frontend/packages/inspector
27+
RUN cd frontend/packages/inspector && pnpm exec vite build
28+
329
# ============================================================================
430
# AMD64 Builder - Uses cross-tools musl toolchain
531
# ============================================================================
@@ -59,10 +85,13 @@ ENV OPENSSL_DIR=/musl \
5985
WORKDIR /build
6086
COPY . .
6187

88+
# Copy pre-built inspector frontend
89+
COPY --from=inspector-build /app/frontend/packages/inspector/dist ./frontend/packages/inspector/dist
90+
6291
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6392
--mount=type=cache,target=/usr/local/cargo/git \
6493
--mount=type=cache,target=/build/target \
65-
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent --release --target x86_64-unknown-linux-musl && \
94+
cargo build -p sandbox-agent --release --target x86_64-unknown-linux-musl && \
6695
cp target/x86_64-unknown-linux-musl/release/sandbox-agent /sandbox-agent
6796

6897
# ============================================================================
@@ -90,10 +119,13 @@ ENV CARGO_INCREMENTAL=0 \
90119
WORKDIR /build
91120
COPY . .
92121

122+
# Copy pre-built inspector frontend
123+
COPY --from=inspector-build /app/frontend/packages/inspector/dist ./frontend/packages/inspector/dist
124+
93125
RUN --mount=type=cache,target=/usr/local/cargo/registry \
94126
--mount=type=cache,target=/usr/local/cargo/git \
95127
--mount=type=cache,target=/build/target \
96-
SANDBOX_AGENT_SKIP_INSPECTOR=1 cargo build -p sandbox-agent --release --target aarch64-unknown-linux-musl && \
128+
cargo build -p sandbox-agent --release --target aarch64-unknown-linux-musl && \
97129
cp target/aarch64-unknown-linux-musl/release/sandbox-agent /sandbox-agent
98130

99131
# ============================================================================

0 commit comments

Comments
 (0)