Skip to content

Commit 71a5bb6

Browse files
Merge pull request #699 from reactome/deploy/content-node-express-pin
Content service image: its packages at the root package.json's versions
2 parents 8e69b00 + bb3497f commit 71a5bb6

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

‎deploy/content-node/Dockerfile‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,28 @@ FROM node:24
77

88
WORKDIR /content-node
99

10-
# Only what the service imports. The repository's own lockfile would drag in
11-
# Angular, Playwright and the CMS to run two endpoints.
12-
RUN npm install --omit=dev --no-audit --no-fund neo4j-driver@^6.2.0 express@5.2.1
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.
16+
COPY package.json ./root-package.json
17+
RUN node -e " \
18+
const root = require('./root-package.json'); \
19+
const dependencies = {}; \
20+
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; \
24+
} \
25+
require('node:fs').writeFileSync('package.json', JSON.stringify({ \
26+
name: 'reactome-content-node', private: true, dependencies \
27+
}, null, 2)); \
28+
" \
29+
&& npm install --omit=dev --no-audit --no-fund \
30+
&& npm cache clean --force \
31+
&& rm root-package.json
1332

1433
COPY tools/content-node/ ./tools/content-node/
1534
# The nearest package.json is what tells Node a .ts module is a module (spec

0 commit comments

Comments
 (0)