Skip to content

Commit ac074e4

Browse files
authored
fix(agent-runtime): slim base to shim + Node/git/tini (drop workspace-init build) (#109)
packages/workspace-strategy is not on fork main and git workspace population is out of the current blank-workspace sandbox-cr scope, so the base no longer builds tools/workspace-init. opencode/pi only need Node+git+tini+user on top of the shim.
1 parent 61c8d06 commit ac074e4

1 file changed

Lines changed: 8 additions & 37 deletions

File tree

docker/agent-runtime/Dockerfile.base

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,14 @@ COPY tools/agent-shim/ ./
1010
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH:-amd64} \
1111
go build -ldflags='-s -w' -o /out/paperclip-agent-shim .
1212

13-
# ---------- Stage 2: build workspace-init (Node) ----------
14-
FROM node:${NODE_VERSION}-bookworm-slim AS wsinit-build
15-
WORKDIR /src
16-
COPY pnpm-lock.yaml package.json pnpm-workspace.yaml tsconfig.base.json ./
17-
# Repo root pnpm config has patchedDependencies referencing ./patches/* — copy
18-
# the patch files so `pnpm install --frozen-lockfile` does not ENOENT on them
19-
# even though we install zero workspaces that consume embedded-postgres.
20-
COPY patches/ ./patches/
21-
COPY packages/workspace-strategy/ ./packages/workspace-strategy/
22-
COPY tools/workspace-init/ ./tools/workspace-init/
23-
RUN corepack enable && pnpm install --frozen-lockfile \
24-
&& pnpm --filter @paperclipai/workspace-strategy build \
25-
&& pnpm --filter @paperclipai/workspace-init build \
26-
# Materialize publishConfig into the live package.json so that Node's
27-
# production module resolution targets dist/ instead of src/*.ts. This
28-
# mirrors what `pnpm publish` does, but for our local consumption inside
29-
# the runtime image where TypeScript loaders are not present.
30-
&& node -e "const f='packages/workspace-strategy/package.json';const p=JSON.parse(require('fs').readFileSync(f,'utf8'));if(p.publishConfig&&p.publishConfig.exports){p.exports=p.publishConfig.exports;}require('fs').writeFileSync(f,JSON.stringify(p,null,2)+'\n');"
31-
32-
# ---------- Stage 3: runtime base image ----------
13+
# ---------- Stage 2: runtime base image ----------
14+
# Ubuntu + Node + git + tini + non-root paperclip user + the agent-shim. This is
15+
# everything the sandbox-cr exec-in model needs: the pod idles (sleep infinity)
16+
# and paperclip-server execs the harness CLI in, so the harness images only add
17+
# their CLI on top of this. workspace-init / workspace-strategy (git workspace
18+
# population for the future job backend) are intentionally NOT built here yet:
19+
# the current cloud scope is a blank workspace, and packages/workspace-strategy
20+
# is not on fork main. Add them back when git workspace population lands.
3321
FROM ubuntu:22.04 AS base
3422
ARG NODE_VERSION
3523
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -44,23 +32,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
4432

4533
COPY --from=shim-build /out/paperclip-agent-shim /usr/local/bin/paperclip-agent-shim
4634

47-
# workspace-init resolves @paperclipai/workspace-strategy via a pnpm workspace
48-
# symlink (tools/workspace-init/node_modules/@paperclipai/workspace-strategy ->
49-
# ../../../../packages/workspace-strategy). Mirror the /src layout under
50-
# /opt/paperclip/app so Node's module resolution and that relative symlink
51-
# both keep working at runtime.
52-
COPY --from=wsinit-build /src/tools/workspace-init/package.json /opt/paperclip/app/tools/workspace-init/package.json
53-
COPY --from=wsinit-build /src/tools/workspace-init/dist /opt/paperclip/app/tools/workspace-init/dist
54-
COPY --from=wsinit-build /src/tools/workspace-init/node_modules /opt/paperclip/app/tools/workspace-init/node_modules
55-
COPY --from=wsinit-build /src/packages/workspace-strategy/package.json /opt/paperclip/app/packages/workspace-strategy/package.json
56-
COPY --from=wsinit-build /src/packages/workspace-strategy/dist /opt/paperclip/app/packages/workspace-strategy/dist
57-
COPY --from=wsinit-build /src/node_modules /opt/paperclip/app/node_modules
58-
59-
# Convenience launcher so the init container can just run `paperclip-workspace-init`
60-
RUN printf '#!/bin/sh\nexec node --enable-source-maps /opt/paperclip/app/tools/workspace-init/dist/index.js "$@"\n' \
61-
> /usr/local/bin/paperclip-workspace-init \
62-
&& chmod +x /usr/local/bin/paperclip-workspace-init
63-
6435
USER 1000:1000
6536
WORKDIR /workspace
6637
ENTRYPOINT ["/usr/bin/tini", "--"]

0 commit comments

Comments
 (0)