@@ -10,26 +10,14 @@ COPY tools/agent-shim/ ./
1010RUN 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.
3321FROM ubuntu:22.04 AS base
3422ARG NODE_VERSION
3523RUN 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
4533COPY --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-
6435USER 1000:1000
6536WORKDIR /workspace
6637ENTRYPOINT ["/usr/bin/tini", "--"]
0 commit comments