fix(docker): copy pruned node_modules from builder stage (lds-api)#180
Merged
TaprootFreak merged 1 commit intodevelopfrom May 8, 2026
Merged
fix(docker): copy pruned node_modules from builder stage (lds-api)#180TaprootFreak merged 1 commit intodevelopfrom
TaprootFreak merged 1 commit intodevelopfrom
Conversation
Stage 2 was running 'npm ci --omit=dev' from scratch, which triggers node-gyp on native deps (solana/eth signers) and fails the same way stage 1 did before — the runtime image base also lacks python/g++. Fix: do 'npm prune --omit=dev' in the builder (drop dev-only deps from the existing node_modules tree, keeping the already-compiled native binaries) and COPY node_modules across to the final stage. This avoids ever re-running node-gyp at runtime-image-build time and keeps the runtime base small (no python/toolchain there).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The previous fix (#179) added
apk add python3 make g++only to the builder stage. The runtime stage runsnpm ci --omit=devfrom scratch, which triggers node-gyp on native deps (solana/eth signers) and fails the same way:Fix
Drop dev-only deps in-place in the builder (
npm prune --omit=dev— keeps the already-compiled native binaries) and COPYnode_modulesacross to the runtime stage instead of reinstalling. node-gyp is never invoked again, runtime image base stays small (no python/toolchain there).Test plan
LDS API DEV CI/CDbuilds and pusheslightningdotspacecom/lds-api:beta