Files
pezkuwi-subquery/docker/Dockerfile.node
T
Satoshi Qazi Muhammed c4f2bd943b Lock the indexer image and close the advisories in the build tooling
The indexer image installed @subql/node and the @polkadot -> @pezkuwi aliases
with an unlocked npm install, and the build cache kept the layer from the day
it was first built: the indexers ran @pezkuwi/wasm-crypto 7.5.17/7.5.18, the
build whose ed25519 and secp256k1 are stubs, plus vm2 3.9.19 (the mapping
sandbox, 54 advisories). No lockfile meant Dependabot never saw that tree.

- docker/indexer holds the image's package.json and package-lock.json:
  @subql/node 6.4.6 as today, @pezkuwi 16.5.39 / 14.0.26 / 7.5.21, overrides
  for vm2 3.12.2, uuid 11 and package-json 7 (got 11). The Dockerfile runs
  npm ci on Node 24 (Node 20 is out of support).
- The pruned-state patch stops the build when a pattern matches nothing,
  instead of reporting success with the fallback missing.
- CI builds the indexer image and runs the crypto smoke test inside it
  through the @polkadot aliases, the way subql-node loads them.
- The root yarn.lock, which the host installs as root on every deploy to run
  subql codegen/build, moves the advisory ranges forward with targeted
  resolutions and @pezkuwi/braces. Left: elliptic (low, via ethers 5 in
  @subql/cli) and sprintf-js (moderate, via jest's argparse 1); neither has
  a fixed release.
2026-10-12 17:14:07 +04:00

32 lines
1.3 KiB
Docker

FROM node:24-alpine
WORKDIR /app
# @subql/node with @polkadot aliased to @pezkuwi. The tree is locked in
# docker/indexer so every build installs the same packages (and Dependabot
# can see them); without the lock a cached layer kept whatever was current
# the day it was first built.
COPY docker/indexer/package.json docker/indexer/package-lock.json ./
RUN npm ci --no-audit --no-fund
# @subql/node requires '@polkadot/api-augment/substrate' but @pezkuwi uses
# chain-specific paths (./pezkuwi, ./bizinikiwi). Patch the exports map in
# package.json to add ./substrate pointing to pezkuwi augmentation.
RUN node -e " \
const fs = require('fs'); \
const p = '/app/node_modules/@polkadot/api-augment/package.json'; \
const pkg = JSON.parse(fs.readFileSync(p, 'utf8')); \
pkg.exports['./substrate'] = { \
require: './cjs/pezkuwi/index.js', \
default: './pezkuwi/index.js' \
}; \
fs.writeFileSync(p, JSON.stringify(pkg, null, 2)); \
"
# Patch: handle pruned blockchain state gracefully.
# Without this, SubQuery crashes when RPC nodes have pruned old block state.
COPY docker/patches/pruned-state-fallback.js /tmp/pruned-state-fallback.js
RUN node /tmp/pruned-state-fallback.js && rm /tmp/pruned-state-fallback.js
ENTRYPOINT ["/app/node_modules/.bin/subql-node"]