From 50253d5d2473b5dfc8881cf05d0eec1a75601c89 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Tue, 9 Jun 2026 11:11:53 +0000 Subject: [PATCH] fix(docker): re-materialize+rebuild vendored grammars after npm prune MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `npm prune --omit=dev` in the gitnexus CLI image drops anything not in package.json's dependency tree — including the VENDORED tree-sitter grammars (materialized by postinstall, not declared deps) and their built bindings. The `serve` image analyzes/parses repos at runtime, so re-run the grammar postinstall after the prune (in the toolchain-equipped builder) to restore them. Load-bearing for tree-sitter-c, a core REQUIRED grammar now vendored (#2116): as a former dependency it survived prune; vendored, it would not. Also restores swift/dart/proto/kotlin, which were silently pruned from the image before. Co-Authored-By: Claude Opus 4.8 (1M context) --- Dockerfile.cli | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Dockerfile.cli b/Dockerfile.cli index cfba9bac4..b5ec3390c 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -36,6 +36,17 @@ RUN npm ci --prefix gitnexus # Drop dev dependencies for a smaller runtime layer. RUN npm prune --omit=dev --prefix gitnexus +# `npm prune` removes anything not in package.json's dependency tree — which +# includes the VENDORED tree-sitter grammars (materialized into node_modules/ by +# postinstall, but not declared as deps) and their freshly-built native bindings. +# The `serve` image analyzes/parses uploaded repos at runtime, so those grammars +# must survive into the runtime layer. Re-run the grammar postinstall here in the +# builder (which still has python3/make/g++ and the hoisted node-addon-api / +# node-gyp-build) to re-materialize + rebuild them after the prune. This is +# load-bearing for tree-sitter-c (a core, REQUIRED grammar now vendored, #2116): +# as a former `dependency` it used to survive prune; vendored, it would not. +RUN npm run postinstall --prefix gitnexus + # -- Runtime ----------------------------------------------------------- # node:22-bookworm-slim FROM node:22-bookworm-slim@sha256:9f6d5975c7dca860947d3915877f85607946403fc55349f39b4bc3688448bb6e AS runtime