nandi/oripublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

Dockerfile · 88 lines · 4.0 KBDocker Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# syntax=docker/dockerfile:1
#
# Ori sandbox template: the ori web application packaged on top of the
# official Docker Sandboxes claude-code template, so the sandbox ships both
# Claude Code and the ori server that fronts it over ACP.
#
# Build from the repository root (the ui and Go sources are the context):
#
#   docker build -f template/Dockerfile -t k33g/ori .
#
# In a sandbox the runtime replaces CMD with its own process manager; the ori
# kit (kits/ori/spec.yaml) is what starts the server. The CMD below makes the
# image also work standalone (docker run -p 8888:8888 k33g/ori).

ARG GO_VERSION=1.26
ARG NODE_VERSION=24

#############################
# Frontend build (Vite SPA) #
#############################
# --platform=$BUILDPLATFORM: the SPA build is platform-independent, so it runs
# once, natively. Without this, the amd64 half of a multi-arch build runs Vite
# under qemu on an arm64 host — where bundling Monaco exhausts Node's heap.
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm AS ui-builder
WORKDIR /src/ui
COPY ui/package.json ui/package-lock.json ./
RUN npm ci
COPY ui/ ./
# prebuild copies the Material icons into public/, then Vite builds to dist/
RUN npm run build

####################
# Go backend build #
####################
# Also native: Go cross-compiles to the target with GOOS/GOARCH, no qemu.
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-bookworm AS go-builder
ARG TARGETOS
ARG TARGETARCH
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY ui/embed.go ./ui/
COPY --from=ui-builder /src/ui/dist ./ui/dist
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o /out/ori ./cmd/ori \
    && CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -trimpath -o /out/ori-mock-agent ./cmd/ori-mock-agent

##############################################################
# Claude Code ACP adapter, fetched natively then copied over #
##############################################################
# @agentclientprotocol/claude-agent-acp drives Claude Code through the Claude
# Agent SDK, which ships a current Claude Code CLI (2.1.274 with SDK 0.3.274)
# as a per-platform optional dependency (@anthropic-ai/claude-agent-sdk-linux-
# x64, -linux-arm64, …). The Zed adapter it replaces bundled CLI 2.1.44, which
# the API now rejects for current models ("version 2.1.251 or newer required").
#
# Still a $BUILDPLATFORM stage (native npm, no qemu), but npm must be told
# which platform's CLI to fetch: --os/--cpu select the optional dependency.
# npm speaks Node's arch names, so Docker's "amd64" has to become "x64" — with
# --cpu=amd64 npm silently installs no native SDK at all and the adapter
# fails at runtime.
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm AS adapter
ARG TARGETARCH
RUN npm_cpu="$TARGETARCH"; [ "$TARGETARCH" = "amd64" ] && npm_cpu=x64; \
    npm install -g --prefix /adapter --os=linux --cpu="$npm_cpu" --no-audit --no-fund \
        @agentclientprotocol/claude-agent-acp \
    && test -d /adapter/lib/node_modules/@agentclientprotocol/claude-agent-acp/node_modules/@anthropic-ai/claude-agent-sdk-linux-"$npm_cpu"

###################################################
# Final image: claude-code sandbox template + ori #
###################################################
FROM docker/sandbox-templates:claude-code

# The adapter lands in the template's npm prefix, which is agent-owned and on
# PATH — so `claude-agent-acp` resolves and the sandbox never needs npx to
# download it at runtime.
COPY --from=adapter --chown=agent:agent /adapter/ /usr/local/share/npm-global/

COPY --from=go-builder /out/ori /out/ori-mock-agent /usr/local/bin/

# ori listens here; publish it from the host with:
#   sbx ports <sandbox-name> --publish 8888:8888/tcp
EXPOSE 8888

# Standalone-run default. Inside a sandbox the ori kit starts the server
# instead (the runtime overrides CMD with its own supervisor).
CMD [ "ori", "--addr", ":8888", "--agent-cmd", "claude-agent-acp", "--cwd", "/home/agent/workspace" ]