Files
devops-lib-gcp/docs/wiki/pages/build/node-paired-files.md
T
2026-08-26 02:02:24 +05:30

2.3 KiB

Generated 2026-05-12 at base-sha 28f54cf7bef9. Type: concept. 0 sources.

Node Build: Paired File Rule

src/com/meesho/stages/buildNode.groovy and resources/com/meesho/node-Dockerfile are paired files. Changes to Node install logic in one must be mirrored in the other to avoid a split-brain build path.

Where it applies in this repo

src/com/meesho/stages/buildNode.groovy:buildDckr resources/com/meesho/node-Dockerfile

How they interact

buildNode.groovy detects the package manager at runtime (npm vs pnpm vs yarn) and passes the install command to the Dockerfile as the npm_install_arg template variable. The Dockerfile's else branch handles the fallback when no explicit or detected command is provided (currently npm ci).

buildNode.buildDckr(config):
  ├─ Detect package manager → npm_install_arg = "pnpm install" | "npm ci" | ...
  ├─ constructTemplate.renderTemplate(binding, 'node-Dockerfile')
  │    └─ binding.npm_install_arg → substituted into node-Dockerfile
  └─ docker build -f Dockerfile ...

When npm_install_arg is not set in config.yaml, buildNode.groovy falls back to its own detection logic. The Dockerfile default branch handles the case where detection produces nothing.

Why this matters

If buildNode.groovy changes the fallback install command or adds support for a new package manager, the Dockerfile default branch must be updated in the same PR. Changing only one file leaves them out of sync: the runtime path may succeed while the Docker fallback uses the old command (or vice versa). This creates subtly different images depending on whether npm_install_arg is explicitly configured.

Sources

(no raw/ sources)

Notes


← Wiki index