docker: the image is Debian 12 slim, so the Cursor and Devin CLIs magpie installs at sign-in run in it (#2834, bborn2)
magpie installs a subscription's CLI at sign-in with its vendor's `curl … | bash` (internal/provider/install.go: Cursor, Devin, Grok Build). The distroless image had no curl and no /usr/bin/env (the installers' shebang), so that install couldn't run there, and only Grok Build had a native fallback. bborn2 reported that a Cursor CLI installed by hand failed with "cannot execute: required file not found". The image is now debian:12-slim with ca-certificates and curl. It keeps the nonroot user at uid/gid 65532, HOME and XDG under /config, the healthcheck, and magpie on PATH. Size: 157MB against 82MB for origin/main's image, both built here on arm64. Running a feature magpie offers is worth the 75MB. Changed in review: dropped the branch's GOPROXY build arg, a separate goal. The comments in install.go and install_test.go that said the image has no curl now say "had". docs/reference.md and the site's Docker page (en, zh, ja) say Debian with bash and curl instead of distroless with busybox. Run, with OrbStack's docker: - docker build of this tree and of d783df46c's Dockerfile: 157MB vs 82MB. - docker run of the new image: health "healthy", user nonroot (id 65532). `curl https://cursor.com/install -fsS | bash` exit 0, then `~/.local/bin/cursor-agent --version` printed 2026.10.16-e3cb207. Devin's install.sh installed devin v3000.11.92 (its trailing `devin setup` said "Login canceled" with no terminal, as on any host). `devin --version` printed 3000.11.92. bash and `magpie version` run. - Old image: `which curl` finds none, and /usr/bin/env doesn't exist. - A volume written by the old image (file owned 65532) was read and written by the new image. - gofmt -l clean; go vet darwin, linux (nogui) and windows clean. - Full `go test -tags nogui -timeout 45m ./...`: every package ok except internal/agent and internal/gateway, which timed out at 45m mid-test (TestConnectSaysHow, TestLargeRequestEndpoints) under a load average of about 200 from parallel suites. This commit changes no code those packages build, only comments in internal/provider, which passed (992s), so they weren't rerun. Not tried: a Grok Build install inside the image, and a full in-magpie Cursor/Devin sign-in with a real account in the container. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed by
yetone
co-authored by
Claude Opus 5.5
parent
ccb2eea159
commit
ae7dc10ae2
+16
-22
@@ -12,31 +12,25 @@ RUN CGO_ENABLED=0 go build -tags nogui -trimpath \
|
||||
-ldflags "-s -w -X main.version=${VERSION}" -o /out/magpie . \
|
||||
&& mkdir -p /config/home /config/cache /config/data /config/state
|
||||
|
||||
# A shell for the container's terminal: NAS panels (Synology, 1Panel,
|
||||
# Portainer) open /bin/bash or /bin/sh, and distroless has neither, so a
|
||||
# terminal there failed with "stat /bin/bash: no such file or directory".
|
||||
# Debian 12's bash (with the libtinfo it links), which runs on the glibc of
|
||||
# distroless's own Debian 12, and busybox for ls, cat and the like.
|
||||
FROM debian:12-slim AS shell
|
||||
RUN mkdir -p /out/bin /out/lib \
|
||||
&& cp /bin/bash /out/bin/bash \
|
||||
&& cp -L "$(ldd /bin/bash | awk '/libtinfo/ {print $3}')" /out/lib/
|
||||
# Debian, not distroless: a subscription's CLI is installed with its
|
||||
# vendor's `curl … | bash` (Cursor, Devin, Grok Build), and the CLI it
|
||||
# installs is a glibc binary that needs a full system's loader and
|
||||
# libraries. distroless with a copied curl ran the installer, but Cursor's
|
||||
# cursor-agent then failed with "cannot execute: required file not found".
|
||||
# Debian 12 has the glibc, libgcc and libstdc++ the plugins' Bun needs too,
|
||||
# and bash for a NAS panel's terminal. nonroot keeps distroless's uid 65532,
|
||||
# so a volume made by an older image stays writable.
|
||||
FROM debian:12-slim
|
||||
|
||||
FROM busybox:1.37-uclibc AS busybox
|
||||
|
||||
# cc, not static: plugins run on Bun, which magpie downloads on first use
|
||||
# and which needs glibc (static has no libc at all, and Bun's musl build
|
||||
# would need musl). cc is static plus glibc, libgcc and libstdc++.
|
||||
FROM gcr.io/distroless/cc-debian12:nonroot
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates curl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd -g 65532 nonroot \
|
||||
&& useradd -u 65532 -g nonroot -d /config/home -s /bin/bash nonroot
|
||||
|
||||
COPY --from=build /out/magpie /magpie
|
||||
COPY --from=busybox /bin/busybox /bin/busybox
|
||||
COPY --from=shell /out/bin/bash /bin/bash
|
||||
COPY --from=shell /out/lib/ /usr/lib/
|
||||
# busybox's commands, and magpie on PATH, so `magpie accounts add …` works
|
||||
# in that terminal
|
||||
USER root
|
||||
RUN ["/bin/busybox", "sh", "-c", "/bin/busybox --install -s /bin && mkdir -p /usr/local/bin && ln -s /magpie /usr/local/bin/magpie"]
|
||||
# magpie on PATH, so `magpie accounts add …` works in that terminal
|
||||
RUN ln -s /magpie /usr/local/bin/magpie
|
||||
USER nonroot
|
||||
COPY --from=build --chown=65532:65532 /config /config
|
||||
|
||||
|
||||
+4
-3
@@ -2230,9 +2230,10 @@ uses the service's gateway.
|
||||
|
||||
### Docker
|
||||
|
||||
`docker build` makes a server image: the terminal-only binary on
|
||||
distroless (`cc`, for the glibc the plugins' Bun needs) with bash and
|
||||
busybox for a terminal in the container (`docker exec -it magpie bash`, or a
|
||||
`docker build` makes a server image: the terminal-only binary on Debian 12
|
||||
slim, with bash and curl, so a vendor's `curl … | bash` installer runs and
|
||||
the CLI it installs (Cursor's, Devin's, Grok Build) finds the glibc it links,
|
||||
as the plugins' Bun does, and a terminal opens in the container (`docker exec -it magpie bash`, or a
|
||||
NAS panel's terminal; `magpie` is on its PATH), run as nonroot,
|
||||
with everything it keeps in a volume at `/config`: magpie's own files
|
||||
(`/config/magpie`), the sign-ins kept where their agent keeps them (HOME is
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
// agentCLI is a CLI a subscription runs through: how to find it, and the
|
||||
// vendor's install one-liners for a POSIX shell and for PowerShell. native,
|
||||
// when there is one, does what the shell one does without a shell, for a
|
||||
// magpie with none (its Docker image has no bash, curl or wget). setup: the
|
||||
// magpie with none (its Docker image had no bash, curl or wget until #2834). setup: the
|
||||
// installer ends by running the CLI's own setup, which asks how to sign in;
|
||||
// magpie signs in itself once the CLI is there.
|
||||
type agentCLI struct {
|
||||
@@ -148,8 +148,10 @@ func runUntilInstalled(ctx context.Context, cmd *exec.Cmd, c agentCLI) ([]byte,
|
||||
// bash, and curl, which every one-liner (and the scripts behind them)
|
||||
// downloads with. magpie's Docker image had none of them, and the install
|
||||
// failed there with "exec: bash: not found". Since 7bfe3137 it has bash and
|
||||
// busybox's wget but still no curl, and the one-liner failed there too. A
|
||||
// var so tests can say there is none.
|
||||
// busybox's wget but still no curl, and the one-liner failed there too.
|
||||
// Since #2834 it is Debian with bash and curl, and the CLIs the one-liners
|
||||
// install find the loader and libraries they link. A var so tests can say
|
||||
// there is none.
|
||||
var shellInstallerRuns = func() bool {
|
||||
for _, p := range []string{"bash", "curl"} {
|
||||
if _, err := exec.LookPath(p); err != nil {
|
||||
|
||||
@@ -98,7 +98,7 @@ func waitPast(t *testing.T, id, state string) SignInState {
|
||||
return SignInState{}
|
||||
}
|
||||
|
||||
// magpie's Docker image has bash and busybox's wget but no curl, which every
|
||||
// magpie's Docker image had bash and busybox's wget but no curl, which every
|
||||
// vendor's one-liner downloads with: there the native installer is used
|
||||
func TestShellInstallerNeedsCurl(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<tr><td><b>Volume</b></td><td><code>/config</code>: providers, keys, sign-ins, plugins and usage</td></tr>
|
||||
<tr><td><b>User</b></td><td>nonroot (uid 65532)</td></tr>
|
||||
</table></div>
|
||||
<p>The image holds magpie’s terminal-only build on distroless, with bash and busybox for a terminal in the container. It runs <code>magpie serve</code> (the gateway alone) unless given another command. The container finds no agents to wire, so magpie in it is a gateway: the agents that use it run elsewhere.</p>
|
||||
<p>The image holds magpie’s terminal-only build on Debian 12 slim, with bash for a terminal in the container and curl for the installers of the CLIs some subscriptions sign in with (Cursor, Devin, Grok Build). It runs <code>magpie serve</code> (the gateway alone) unless given another command. The container finds no agents to wire, so magpie in it is a gateway: the agents that use it run elsewhere.</p>
|
||||
|
||||
<h2 id="run"><a class="anchor" href="#run">Run it</a></h2>
|
||||
<p>Run it with the browser UI, a key for that page you keep across restarts, and both ports on the host’s loopback only:</p>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<tr><td><b>ボリューム</b></td><td><code>/config</code>:プロバイダ、キー、サインイン、プラグイン、使用量</td></tr>
|
||||
<tr><td><b>ユーザー</b></td><td>nonroot(uid 65532)</td></tr>
|
||||
</table></div>
|
||||
<p>イメージに入っているのはターミナル専用ビルドの magpie で、distroless をベースに、コンテナ内でターミナルを使うための bash と busybox を含みます。コマンドを指定しなければ <code>magpie serve</code>(ゲートウェイのみ)を実行します。コンテナ内には設定するエージェントがないので、ここでの magpie はゲートウェイです。それを使うエージェントはほかのマシンで動きます。</p>
|
||||
<p>イメージに入っているのはターミナル専用ビルドの magpie で、Debian 12 slim をベースに、コンテナ内でターミナルを使うための bash と、一部のサブスクリプションのサインインに必要な CLI(Cursor、Devin、Grok Build)をインストールするための curl を含みます。コマンドを指定しなければ <code>magpie serve</code>(ゲートウェイのみ)を実行します。コンテナ内には設定するエージェントがないので、ここでの magpie はゲートウェイです。それを使うエージェントはほかのマシンで動きます。</p>
|
||||
|
||||
<h2 id="run"><a class="anchor" href="#run">起動する</a></h2>
|
||||
<p>ブラウザ UI 付きで、再起動しても変わらないページ用のキーを渡し、両方のポートをホストのループバックだけに公開して起動します。</p>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<tr><td><b>数据卷</b></td><td><code>/config</code>:供应商、密钥、登录、插件和用量</td></tr>
|
||||
<tr><td><b>用户</b></td><td>nonroot(uid 65532)</td></tr>
|
||||
</table></div>
|
||||
<p>镜像里是 magpie 的纯终端版本,基于 distroless,并带了 bash 和 busybox,方便在容器里开终端。不指定命令时运行 <code>magpie serve</code>(只有网关)。容器里找不到需要配置的 Agent,所以这里的 magpie 是一个网关:用它的 Agent 运行在别的机器上。</p>
|
||||
<p>镜像里是 magpie 的纯终端版本,基于 Debian 12 slim,带 bash,方便在容器里开终端,也带 curl,用来安装部分订阅登录时需要的 CLI(Cursor、Devin、Grok Build)。不指定命令时运行 <code>magpie serve</code>(只有网关)。容器里找不到需要配置的 Agent,所以这里的 magpie 是一个网关:用它的 Agent 运行在别的机器上。</p>
|
||||
|
||||
<h2 id="run"><a class="anchor" href="#run">运行</a></h2>
|
||||
<p>带 Web 界面运行,给页面一个重启后不变的 key,两个端口都只发布在宿主机的回环地址上:</p>
|
||||
|
||||
Reference in New Issue
Block a user