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 | ############################################################## | |
| 52 | # Installed in a $BUILDPLATFORM stage (the package is JavaScript, and its | |
| 53 | # vendored binaries ship for every platform) so the final stage needs no RUN | |
| 54 | # at all — a multi-arch build never touches qemu. | |
| 55 | FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm AS adapter | |
| 56 | RUN npm install -g --prefix /adapter @zed-industries/claude-code-acp | |
| 57 | ||
| 58 | ################################################### | |
| 59 | # Final image: claude-code sandbox template + ori # | |
| 60 | ################################################### | |
| 61 | FROM docker/sandbox-templates:claude-code | |
| 62 | ||
| 63 | # The adapter lands in the template's npm prefix, which is agent-owned and on | |
| 64 | # PATH — so `claude-code-acp` resolves and the sandbox never needs npx to | |
| 65 | # download it at runtime. | |
| 66 | COPY --from=adapter --chown=agent:agent /adapter/ /usr/local/share/npm-global/ | |
| 67 | ||
| 68 | COPY --from=go-builder /out/ori /out/ori-mock-agent /usr/local/bin/ | |
| 69 | ||
| 70 | # ori listens here; publish it from the host with: | |
| 71 | # sbx ports <sandbox-name> --publish 8888:8888/tcp | |
| 72 | EXPOSE 8888 | |
| 73 | ||
| 74 | # Standalone-run default. Inside a sandbox the ori kit starts the server | |
| 75 | # instead (the runtime overrides CMD with its own supervisor). | |
| 76 | CMD [ "ori", "--addr", ":8888", "--agent-cmd", "claude-code-acp", "--cwd", "/home/agent/workspace" ] |