From 5168c69af9c89e554f9cf1275d246d4a22ee8ae4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 10:40:11 +0000 Subject: [PATCH] fix(docker): remove npm from runtime image The node base image ships npm, which bundles its own dependencies such as undici 6.28.0 with known CVEs. The app is started with node directly and never uses npm at runtime, so remove it from the final image. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01P2AmTW9mCkZb9fwBj2GAtV --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ce87d411..cf92d66e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,8 @@ ENV VERSION=${VERSION} WORKDIR /app # Do not install yarn here: Alpine's yarn package pulls in Alpine's own nodejs -RUN chown node:node /app +# npm is not used at runtime and ships its own dependencies (e.g. undici) +RUN chown node:node /app && rm -rf /usr/local/lib/node_modules/npm /usr/local/bin/npm /usr/local/bin/npx # Copy built application from builder COPY --from=builder --chown=node:node /app/dist ./dist