forked from bots-garden/ori
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 1 | # syntax=docker/dockerfile:1 |
| 2 | # | |
| 3 | # Ori sandbox template: the ori web application packaged on top of the | |
| 4 | # official Docker Sandboxes claude-code template, so the sandbox ships both | |
| 5 | # Claude Code and the ori server that fronts it over ACP. | |
| 6 | # | |
| 7 | # Build from the repository root (the ui and Go sources are the context): | |
| 8 | # | |
| 9 | # docker build -f template/Dockerfile -t k33g/ori . | |
| 10 | # | |
| 11 | # In a sandbox the runtime replaces CMD with its own process manager; the ori | |
| 12 | # kit (kits/ori/spec.yaml) is what starts the server. The CMD below makes the | |
| 13 | # image also work standalone (docker run -p 8888:8888 k33g/ori). | |
| 14 | ||
| 15 | ARG GO_VERSION=1.26 | |
| 16 | ARG NODE_VERSION=24 | |
| 17 | ||
| 18 | ############################# | |
| 19 | # Frontend build (Vite SPA) # | |
| 20 | ############################# | |
| 21 | # --platform=$BUILDPLATFORM: the SPA build is platform-independent, so it runs | |
| 22 | # once, natively. Without this, the amd64 half of a multi-arch build runs Vite | |
| 23 | # under qemu on an arm64 host — where bundling Monaco exhausts Node's heap. | |
| 24 | FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm AS ui-builder | |
| 25 | WORKDIR /src/ui | |
| 26 | COPY ui/package.json ui/package-lock.json ./ | |
| 27 | RUN npm ci | |
| 28 | COPY ui/ ./ | |
| 29 | # prebuild copies the Material icons into public/, then Vite builds to dist/ | |
| 30 | RUN npm run build | |
| 31 | ||
| 32 | #################### | |
| 33 | # Go backend build # | |
| 34 | #################### | |
| 35 | # Also native: Go cross-compiles to the target with GOOS/GOARCH, no qemu. | |
| 36 | FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS go-builder | |
| 37 | ARG TARGETOS | |
| 38 | ARG TARGETARCH | |
| 39 | WORKDIR /src | |
| 40 | COPY go.mod go.sum ./ | |
| 41 | RUN go mod download | |
| 42 | COPY cmd/ ./cmd/ | |
| 43 | COPY internal/ ./internal/ | |
| 44 | COPY ui/embed.go ./ui/ | |
| 45 | COPY --from=ui-builder /src/ui/dist ./ui/dist | |
| 46 | RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o /out/ori ./cmd/ori \ | |
| 47 | && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o /out/ori-mock-agent ./cmd/ori-mock-agent | |
| 48 | ||
| 49 | ############################################################## | |
| 50 | # Claude Code ACP adapter, fetched natively then copied over # | |
| 51 | ############################################################## | |
| ✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) | 52 | # @agentclientprotocol/claude-agent-acp drives Claude Code through the Claude |
| 53 | # Agent SDK, which ships a current Claude Code CLI (2.1.274 with SDK 0.3.274) | |
| 54 | # as a per-platform optional dependency (@anthropic-ai/claude-agent-sdk-linux- | |
| 55 | # x64, -linux-arm64, …). The Zed adapter it replaces bundled CLI 2.1.44, which | |
| 56 | # the API now rejects for current models ("version 2.1.251 or newer required"). | |
| 57 | # | |
| 58 | # Still a $BUILDPLATFORM stage (native npm, no qemu), but npm must be told | |
| 59 | # which platform's CLI to fetch: --os/--cpu select the optional dependency. | |
| 60 | # npm speaks Node's arch names, so Docker's "amd64" has to become "x64" — with | |
| 61 | # --cpu=amd64 npm silently installs no native SDK at all and the adapter | |
| 62 | # fails at runtime. | |
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 63 | FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm AS adapter |
| ✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) | 64 | ARG TARGETARCH |
| 65 | RUN npm_cpu="$TARGETARCH"; [ "$TARGETARCH" = "amd64" ] && npm_cpu=x64; \ | |
| 66 | npm install -g --prefix /adapter --os=linux --cpu="$npm_cpu" --no-audit --no-fund \ | |
| 67 | @agentclientprotocol/claude-agent-acp \ | |
| 68 | && test -d /adapter/lib/node_modules/@agentclientprotocol/claude-agent-acp/node_modules/@anthropic-ai/claude-agent-sdk-linux-"$npm_cpu" | |
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 69 | |
| 70 | ################################################### | |
| 71 | # Final image: claude-code sandbox template + ori # | |
| 72 | ################################################### | |
| 73 | FROM docker/sandbox-templates:claude-code | |
| 74 | ||
| 75 | # The adapter lands in the template's npm prefix, which is agent-owned and on | |
| ✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) | 76 | # PATH — so `claude-agent-acp` resolves and the sandbox never needs npx to |
| ✨ Workspace panel, selectors, previews, desktop app, sandbox template, resizable file tree, light/dark theme | 77 | # download it at runtime. |
| 78 | COPY --from=adapter --chown=agent:agent /adapter/ /usr/local/share/npm-global/ | |
| 79 | ||
| 80 | COPY --from=go-builder /out/ori /out/ori-mock-agent /usr/local/bin/ | |
| 81 | ||
| 82 | # ori listens here; publish it from the host with: | |
| 83 | # sbx ports <sandbox-name> --publish 8888:8888/tcp | |
| 84 | EXPOSE 8888 | |
| 85 | ||
| 86 | # Standalone-run default. Inside a sandbox the ori kit starts the server | |
| 87 | # instead (the runtime overrides CMD with its own supervisor). | |
| ✨ Switch the ACP adapter to @agentclientprotocol/claude-agent-acp (template 0.0.2) | 88 | CMD [ "ori", "--addr", ":8888", "--agent-cmd", "claude-agent-acp", "--cwd", "/home/agent/workspace" ] |