Skip to content

chore(docker): Node 22 on Debian trixie, no build tools in the runtime images - #1266

Merged
tmigone merged 2 commits into
graphprotocol:mainfrom
pinax-network:indexer/chore/docker-trixie-node22
Nov 20, 2026
Merged

tmigone merged 2 commits into
graphprotocol:mainfrom
pinax-network:indexer/chore/docker-trixie-node22

Conversation

@matthewdarwin

Copy link
Copy Markdown
Contributor

Summary

The indexer-agent and indexer-cli images are built on node:20.11-bookworm-slim (Node 20 reached end of life in April 2026; Debian 12.5 base never refreshed) and install python3 build-essential git curl in the runtime stage; the CLI image also installs Rust, last needed by the removed indexer-native. The v0.25.13 images are 1.7 GB (agent) and 3.1 GB (CLI), including a 754 MB yarn cache.

  • Base: node:22-trixie-slim (Node 22.23.5, Debian 13.7), pinned by multi-arch index digest via an ARG NODE_IMAGE. Node 22 is the newest version in the CI matrix (tests.yml: 20, 22) and is LTS until April 2027.
  • Stages: toolchain (python3, build-essential) → build (unchanged dev install and compile) → deps (the same yarn --frozen-lockfile --production=true the runtime stage ran before, now with the toolchain present, then yarn cache clean) → runtime (clean base + COPY --from=deps /opt/indexer).
  • Removed from the runtime: python3 and build-essential (only needed when a native module compiles during yarn install, which now happens in deps), git (no git dependencies in yarn.lock, no exec of git), curl (only used to fetch rustup), Rust in the CLI image, the yarn cache.
  • Unchanged: entrypoints, WORKDIRs, NODE_OPTIONS, ETHEREUM, the graph symlink and the CLI's graph user (uid 10001).

Native modules (keccak, @nomicfoundation/edr, solidity-analyzer) are N-API with linux-x64 prebuilds. keccak has no linux-arm64 prebuild; on arm64 it compiles in the deps stage, where the toolchain is (not tested here — no arm64 builder).

Testing

Built both images from this branch (amd64) and compared with the published v0.25.13 images:

Test v0.25.13 this PR
node --version, OS 20.11.1, Debian 12.5 22.23.5, Debian 13.7
Agent --help / start --help pass pass (identical output)
Native and key modules load (keccak, pg, sequelize, ethers, toolshed, tap-contracts-bindings, common-ts, fastify, express, @nomicfoundation/edr, solidity-analyzer); keccak digest pass pass (same digest)
CLI: graph indexer --help, graph --version, graph indexer status without config pass pass
Agent start-up against postgres:17 with a JSON-RPC stub for chain id / graph-node status: connects, runs all 27 migrations, syncs models, connects to Horizon and Subgraph Service contracts, stays up pass pass (same log sequence)
yarn test:ci on Node 22 (node:22-trixie-slim, postgres:13 as in CI): indexer-common 196 passed (43 skipped as in repo), indexer-agent 11, indexer-cli 82 — pass

Trivy 0.76.1 (same vulnerability DB for all rows):

Image Critical High Fixable C+H OS C/H npm C/H Size
indexer-agent v0.25.13 18 520 279 7/269 11/251 1.72 GB
indexer-agent (this PR) 3 161 118 0/47 3/114 600 MB
indexer-cli v0.25.13 16 411 168 7/269 9/142 3.13 GB
indexer-cli (this PR) 4 161 119 0/47 4/114 597 MB

The remaining criticals come from lockfile pins, not the image: sequelize 6.33.0 (root resolutions; fixed in 6.37.4), form-data 4.0.2 (4.0.4), proxy-addr 2.0.7 (2.0.8), and in the CLI ejs 2.7.4 via gluegun (3.1.7). Those are separate yarn.lock/resolutions bumps, not in this PR.

🤖 Generated with Claude Code

@github-project-automation github-project-automation Bot moved this to 🗃️ Inbox in Indexer Nov 19, 2026
@github-project-automation github-project-automation Bot moved this from 🗃️ Inbox to ✅ Approved in Indexer Nov 20, 2026
@tmigone
tmigone self-requested a review November 20, 2026 13:31

@tmigone tmigone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an issue with arm64 when building the images:

28.48 [5/5] Building fresh packages...
30.03 error /opt/indexer/node_modules/@parcel/watcher: Command failed.
30.03 Exit code: 1
30.03 Command: node-gyp-build
30.03 Arguments:
30.03 Directory: /opt/indexer/node_modules/@parcel/watcher
30.03 Output:
30.03 gyp info it worked if it ends with ok
30.03 gyp info using node-gyp@9.4.1
30.03 gyp info using node@22.23.5 | linux | arm64
30.03 (node:77) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
30.03 (Use `node --trace-deprecation ...` to show where the warning was created)
30.03 gyp info find Python using Python version 3.13.5 found at "/usr/bin/python3"
30.03 gyp http GET https://nodejs.org/download/release/v22.23.5/node-v22.23.5-headers.tar.gz
30.03 gyp http 200 https://nodejs.org/download/release/v22.23.5/node-v22.23.5-headers.tar.gz
30.03 gyp http GET https://nodejs.org/download/release/v22.23.5/SHASUMS256.txt
30.03 gyp http 200 https://nodejs.org/download/release/v22.23.5/SHASUMS256.txt
30.03 gyp info spawn /usr/bin/python3
30.03 gyp info spawn args [
30.03 gyp info spawn args   '/opt/indexer/node_modules/node-gyp/gyp/gyp_main.py',
30.03 gyp info spawn args   'binding.gyp',
30.03 gyp info spawn args   '-f',
30.03 gyp info spawn args   'make',
30.03 gyp info spawn args   '-I',
30.03 gyp info spawn args   '/opt/indexer/node_modules/@parcel/watcher/build/config.gypi',
30.03 gyp info spawn args   '-I',
30.03 gyp info spawn args   '/opt/indexer/node_modules/node-gyp/addon.gypi',
30.03 gyp info spawn args   '-I',
30.03 gyp info spawn args   '/root/.cache/node-gyp/22.23.5/include/node/common.gypi',
30.03 gyp info spawn args   '-Dlibrary=shared_library',
30.03 gyp info spawn args   '-Dvisibility=default',
30.03 gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/22.23.5',
30.03 gyp info spawn args   '-Dnode_gyp_dir=/opt/indexer/node_modules/node-gyp',
30.03 gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/22.23.5/<(target_arch)/node.lib',
30.03 gyp info spawn args   '-Dmodule_root_dir=/opt/indexer/node_modules/@parcel/watcher',
30.03 gyp info spawn args   '-Dnode_engine=v8',
30.03 gyp info spawn args   '--depth=.',
30.03 gyp info spawn args   '--no-parallel',
30.03 gyp info spawn args   '--generator-output',
30.03 gyp info spawn args   'build',
30.03 gyp info spawn args   '-Goutput_dir=.'
30.03 gyp info spawn args ]
30.03 Traceback (most recent call last):
30.03   File "/opt/indexer/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
30.03     import gyp  # noqa: E402
30.03     ^^^^^^^^^^
30.03   File "/opt/indexer/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
30.03     import gyp.input
30.03   File "/opt/indexer/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
30.03     from distutils.version import StrictVersion
30.03 ModuleNotFoundError: No module named 'distutils'
30.03 gyp ERR! configure error
30.03 gyp ERR! stack Error: `gyp` failed with exit code: 1
30.03 gyp ERR! stack     at ChildProcess.onCpExit (/opt/indexer/node_modules/node-gyp/lib/configure.js:325:16)
30.03 gyp ERR! stack     at ChildProcess.emit (node:events:519:28)
30.03 gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
30.03 gyp ERR! System Linux 6.12.76-linuxkit
30.03 gyp ERR! command "/usr/local/bin/node" "/opt/indexer/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
30.03 gyp ERR! cwd /opt/indexer/node_modules/@parcel/watcher
30.03 gyp ERR! node -v v22.23.5
30.03 gyp ERR! node-gyp -v v9.4.1
30.03 gyp ERR! not ok

Looks like on arm64, @parcel/watcher dependency has no prebuilt binary, so it gets compiled by node-gyp 9, which relies on Python's distutils module, and Debian trixie's Python 3.13 no longer includes that module.

Adding python3-setuptools to the apt-get install on the toolchain stage fixes the issue on both images.

@github-project-automation github-project-automation Bot moved this from ✅ Approved to 📐 Changes requested in Indexer Nov 20, 2026
@matthewdarwin

Copy link
Copy Markdown
Contributor Author

Thanks @tmigone, good catch. Added python3-setuptools to the toolchain stage of both images, with a comment saying why. I don't have an arm64 builder here, so I checked the mechanism on amd64 in node:22-trixie-slim: with python3 alone, from distutils.version import StrictVersion fails with the same ModuleNotFoundError; after installing python3-setuptools it imports. The toolchain stage is only used by the build stages, so the runtime images are unchanged.

matthewdarwin and others added 2 commits November 20, 2026 09:36
…e images

- Base node:20.11-bookworm-slim (Node 20 is end of life) -> node:22-trixie-slim
  pinned by digest, the newest Node in the CI matrix.
- python3/build-essential move to a toolchain stage; the production
  'yarn --production' install runs there and the runtime copies the result,
  so the runtime images carry no compilers, git, curl or yarn cache.
- indexer-cli no longer installs Rust (only needed by the removed
  indexer-native).

Entrypoints, NODE_OPTIONS, the graph symlink and the CLI user are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
node-gyp 9 imports distutils, which Python 3.13 (trixie) no longer ships.
On arm64 @parcel/watcher has no prebuilt binary and is compiled, so the
build failed there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@matthewdarwin
matthewdarwin force-pushed the indexer/chore/docker-trixie-node22 branch from 3eeaca7 to 2a8a02b Compare November 20, 2026 14:36
@github-project-automation github-project-automation Bot moved this from 📐 Changes requested to ✅ Approved in Indexer Nov 20, 2026
@tmigone
tmigone merged commit c60e9cf into graphprotocol:main Nov 20, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from ✅ Approved to 🚗 Merged in Indexer Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚗 Merged

Development

Successfully merging this pull request may close these issues.

2 participants