From 3be9f08232ee431aad36de293672ee78cf4e7fe3 Mon Sep 17 00:00:00 2001 From: jmlago Date: Wed, 12 Aug 2026 20:54:33 +0100 Subject: [PATCH] fix: preserve the AntSeed CLI package context --- .github/workflows/ci.yml | 3 +++ Dockerfile.antseed | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1175aa..97543ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,6 +94,9 @@ jobs: -v "$PWD/scripts/check_sidecar_modules.js:/tmp/check.js:ro" \ --entrypoint node unhardcoded-antseed:ci /tmp/check.js + - name: AntSeed CLI resolves its package dependencies inside the image + run: docker run --rm --entrypoint antseed unhardcoded-antseed:ci --help >/dev/null + # --network host so the container reaches the runner's postgres service on # localhost; a bridged container cannot. No `|| true` on the run: a # container that fails to start must fail the job, not fall through to a diff --git a/Dockerfile.antseed b/Dockerfile.antseed index 00c79ba..4cf23bb 100644 --- a/Dockerfile.antseed +++ b/Dockerfile.antseed @@ -10,7 +10,12 @@ FROM node:22-slim AS antseed-dependencies # releases undeployable; none of this toolchain is copied into the runtime. RUN apt-get update \ && apt-get install -y --no-install-recommends python3 make g++ \ - && npm install -g @antseed/cli@0.1.128 pg@8.16.3 \ + && for install_attempt in 1 2 3; do \ + if npm install -g @antseed/cli@0.1.128 pg@8.16.3; then break; fi; \ + rm -rf /usr/local/lib/node_modules/@antseed \ + /usr/local/lib/node_modules/pg /usr/local/bin/antseed; \ + if [ "${install_attempt}" = 3 ]; then exit 1; fi; \ + done \ && rm -rf /var/lib/apt/lists/* FROM node:22-slim @@ -23,7 +28,9 @@ RUN apt-get update \ # `pg` is the market writer's Postgres client (write-market.js upserts peer_offers # into the shared host store). NODE_PATH lets the scripts require these globals. COPY --from=antseed-dependencies /usr/local/lib/node_modules /usr/local/lib/node_modules -COPY --from=antseed-dependencies /usr/local/bin/antseed /usr/local/bin/antseed +# Docker COPY dereferences the npm-created bin symlink. Recreate it explicitly +# so Node resolves package imports from @antseed/cli instead of /usr/local/bin. +RUN ln -s ../lib/node_modules/@antseed/cli/dist/cli/index.js /usr/local/bin/antseed ENV NODE_PATH=/usr/local/lib/node_modules # Every non-test file under antseed/ — an explicit list silently ships a module