fix(dockerfile): replace monorepo COPY paths with standalone npm install#14
fix(dockerfile): replace monorepo COPY paths with standalone npm install#14toon-backlog-bot[bot] wants to merge 2 commits into
Conversation
Dockerfile.dvm previously COPYd monorepo paths (packages/*, docker/, pnpm-workspace.yaml, pnpm-lock.yaml, patches/) that do not exist in this standalone repo, causing `docker build -f Dockerfile.dvm .` to fail. Changes: - Replace the pnpm-workspace multi-package install with a plain `npm install` against the repo root package.json (all @toon-protocol/* deps come from npm) - Replace the inline pnpm workspace build (`pnpm -r --filter ...`) with a direct esbuild invocation on src/entrypoint-dvm.ts - Align --external flags with esbuild.config.mjs: @ardrive/turbo-sdk, arweave, better-sqlite3, plus @libsql/client/libsql (connector SQLite store) and the connector's dynamic requireOptional() packages - Replace the pnpm-store cherry-pick of runtime externals with a clean `npm install` in /tmp inside the builder stage (build tools available) - Drop the index.cjs PetBrain stub (kind:5250 Dungeon DVM; not in this image) - Remove the stale follow-up note from CLAUDE.md and README.md Note: `docker build` requires the private @toon-protocol/mill package to be resolvable (it is listed in package.json). This resolves once PR #9 lands and removes non-dvm deps, or when the npm registry has the package. Closes #13 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ALLiDoizCode
left a comment
There was a problem hiding this comment.
Two blocking issues; the structural simplification is otherwise sound and a clear improvement over the monorepo-COPY approach.
1. Builder stage npm install fails on @toon-protocol/mill@^0.1.0 — PR is not self-contained
package.json line 22 lists @toon-protocol/mill@^0.1.0 as a dependency. The package is not on the public npm registry, so the builder-stage RUN npm install --ignore-scripts will fail unconditionally, making the Dockerfile non-functional as written.
The PR acknowledges this depends on PR #9, but that creates a broken main between merging this PR and merging #9. Options:
- Include the
package.jsoncleanup (remove@toon-protocol/millor move it to an optional dep) in this PR. - Block this PR on PR #9 and merge them atomically (rebase or merge #9 first).
- Gate the CI job with a
continue-on-errornote — not ideal, but at least doesn't breakmain.
2. Runtime externals installed without version pins — non-deterministic image
RUN cd /tmp && npm init -y && \
npm install --omit=dev \
better-sqlite3 \
@ardrive/turbo-sdk \
arweave \
@libsql/client \
libsql && \No lockfile, no version constraints. Every docker build can pull different patch/minor versions from the registry, making images non-reproducible across CI runs, local builds, and production deployments. The old Dockerfile pinned @libsql/client@0.14.0 libsql@0.4.7 @ardrive/turbo-sdk@1.40.2; the new one should pin all five packages to the versions actually verified during development. Supply-chain wise, an unpinned npm install in a Dockerfile is a known risk vector.
Fix: add explicit version pins to the install line, e.g.:
npm install --omit=dev \
better-sqlite3@9.x.x \
@ardrive/turbo-sdk@1.40.x \
arweave@1.15.x \
@libsql/client@0.14.x \
libsql@0.4.x && \(Fill in the versions that the builder-stage npm install resolves once issue #1 is fixed.)
Everything else looks correct:
- The
"--banner:js=..."quoting change is shell-equivalent to the old--banner:js="..."form. - Dropping
fastify/@fastify/cors/@noble/curvesfrom--externalis intentional and correct —esbuild.config.mjsties those to thetoon-cliententrypoint, not the DVM one. arweaveas an explicit external and explicit runtime install is correct given the dynamicimport('arweave')increateTurboAdapter.- Non-root user, two-stage build, VOLUME/HEALTHCHECK all carry over correctly.
- The
index.cjsPetBrain stub removal is valid — kind:5250 is gone from this image.
… mill dep - Remove @toon-protocol/mill from package.json (package is not on the public npm registry, so the builder-stage `npm install` failed unconditionally). All other @toon-protocol/* deps are confirmed available on npm. - Pin all five runtime-externals in the Dockerfile.dvm /tmp npm install: better-sqlite3@9.6.0, @ardrive/turbo-sdk@1.40.2, arweave@1.15.7, @libsql/client@0.14.0, libsql@0.4.7. The libsql versions match the existing Dockerfile.mill/town precedent; turbo-sdk@1.40.2 matches the old pinned Dockerfile; arweave@1.15.7 satisfies turbo-sdk's ^1.15.1 peer; better-sqlite3@9.6.0 is the latest v9.x compatible with Node 20. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Addressed both blocking issues in commit 7312d0e: Issue 1 — Issue 2 — unpinned runtime externals
|
|
Superseded by #18, which landed the standalone Dockerfile fix on |
Summary
Dockerfile.dvmto work in the standalone repo — removes all monorepo COPY paths (packages/*/package.json,pnpm-workspace.yaml,pnpm-lock.yaml,patches/,docker/) that don't exist here.npm installagainst the rootpackage.json(all@toon-protocol/*deps come from npm).pnpm -r --filter @toon-protocol/...) with a directesbuildinvocation onsrc/entrypoint-dvm.ts.--externalflags withesbuild.config.mjs:@ardrive/turbo-sdk,arweave,better-sqlite3, plus@libsql/client/libsql(connector's claim SQLite store) and the connector'srequireOptional()packages.npm installin/tmpinside the builder stage (build tools available there).index.cjsPetBrain stub (was for kind:5250 Dungeon DVM; not in this image).CLAUDE.mdandREADME.md.Deviations from Agent Assessment plan
None — the plan maps directly to the changes made.
Known dependency
docker buildrequires all deps inpackage.jsonto be resolvable from npm. The currentpackage.jsonlists@toon-protocol/mill@^0.1.0which is not yet on the public registry; this same issue is addressed by PR #9'spackage.jsoncleanup. The Dockerfile is structurally correct once PR #9 (or equivalent package.json cleanup) lands, or if the CI runner has private registry access.Verification
Closes #13