th Claude Opus 5.5 commited on
Commit
26aa6a7
·
1 Parent(s): 4dd1c7b

fix(security): run Node 22.23.4 instead of Debian's Node 20.19.2

Browse files

Node 20 is EOL and affected by the 2026-10-21 Node.js security release.
Copy the patched node binary + npm from a pinned node:22.23.4-slim stage
and drop apt nodejs/npm. Verified locally: 4 charts (leap month, late-zi
hour) byte-identical between old and new runtime; test_golden_charts 9/9.

🦊 Generated with Sisi

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. Dockerfile +8 -6
Dockerfile CHANGED
@@ -1,7 +1,9 @@
1
  # 🔮 Ziwei Doushu API Dockerfile
2
  # Multi-stage build: Node.js + Python
3
 
4
- FROM node:18-slim AS node-base
 
 
5
 
6
  WORKDIR /app
7
 
@@ -18,11 +20,11 @@ FROM python:3.11-slim
18
 
19
  WORKDIR /app
20
 
21
- # Install system dependencies
22
- RUN apt-get update && apt-get install -y \
23
- nodejs \
24
- npm \
25
- && rm -rf /var/lib/apt/lists/*
26
 
27
  # Copy Node.js files from previous stage
28
  COPY --from=node-base /app/node_modules ./node_modules
 
1
  # 🔮 Ziwei Doushu API Dockerfile
2
  # Multi-stage build: Node.js + Python
3
 
4
+ # 2026-10-23: Node 18 (EOL) → 22.23.4, the patched release from the 2026-10-21 Node.js security advisory.
5
+ # Pin the exact version so a rebuild never silently picks up an older image.
6
+ FROM node:22.23.4-slim AS node-base
7
 
8
  WORKDIR /app
9
 
 
20
 
21
  WORKDIR /app
22
 
23
+ # Node runtime: copy the patched binary + npm from the node stage instead of Debian's apt nodejs
24
+ # (apt gave Node 18, which no longer receives security fixes). npm is only a fallback for ensure_node_dependencies().
25
+ COPY --from=node-base /usr/local/bin/node /usr/local/bin/node
26
+ COPY --from=node-base /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm
27
+ RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && node --version && npm --version
28
 
29
  # Copy Node.js files from previous stage
30
  COPY --from=node-base /app/node_modules ./node_modules