@@ -7,28 +7,35 @@ FROM node:24
77
88WORKDIR /content-node
99
10- # Only what the service imports, at the versions the root package.json pins,
11- # read from it rather than restated here (as the render service does). The
12- # repository's own lockfile would drag in Angular, Playwright and the CMS to
13- # run two packages. A pin restated here stayed at express 5.2.1 when
14- # Dependabot moved the root to 5.3.0 (it watches only the root), so the image
15- # would have run a version nothing here tested.
10+ # Only what the service imports, at the versions the repository resolves and
11+ # tests: each must be a dependency of the root package.json, and is installed
12+ # at the version the root lockfile resolved for it. The repository's own
13+ # lockfile would drag in Angular, Playwright and the CMS to run two packages.
14+ # A pin restated here stayed at express 5.2.1 when Dependabot moved the root
15+ # to 5.3.0 (it watches only the root); a range read from package.json
16+ # (neo4j-driver's ^6.2.0) would take the newest 6.x at build time, untested.
17+ # Their own dependencies still resolve at build time, within express's and
18+ # the driver's ranges.
1619COPY package.json ./root-package.json
20+ COPY package-lock.json ./root-lock.json
1721RUN node -e " \
1822 const root = require('./root-package.json'); \
23+ const lock = require('./root-lock.json'); \
1924 const dependencies = {}; \
2025 for (const name of ['express', 'neo4j-driver']) { \
21- const version = (root.dependencies ?? {})[name]; \
22- if (!version) throw new Error(name + ' is not a dependency of the root package'); \
23- dependencies[name] = version; \
26+ if (!(root.dependencies ?? {})[name]) \
27+ throw new Error(name + ' is not a dependency of the root package'); \
28+ const locked = (lock.packages ?? {})['node_modules/' + name]; \
29+ if (!locked?.version) throw new Error(name + ' is not in the root lockfile'); \
30+ dependencies[name] = locked.version; \
2431 } \
2532 require('node:fs').writeFileSync('package.json', JSON.stringify({ \
2633 name: 'reactome-content-node', private: true, dependencies \
2734 }, null, 2)); \
2835 " \
2936 && npm install --omit=dev --no-audit --no-fund \
3037 && npm cache clean --force \
31- && rm root-package.json
38+ && rm root-package.json root-lock.json
3239
3340COPY tools/content-node/ ./tools/content-node/
3441# The nearest package.json is what tells Node a .ts module is a module (spec
0 commit comments