Skip to content

fix(docker): copy pruned node_modules from builder stage (lds-api)#180

Merged
TaprootFreak merged 1 commit intodevelopfrom
fix/dockerfile-stage2-prune
May 8, 2026
Merged

fix(docker): copy pruned node_modules from builder stage (lds-api)#180
TaprootFreak merged 1 commit intodevelopfrom
fix/dockerfile-stage2-prune

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

The previous fix (#179) added apk add python3 make g++ only to the builder stage. The runtime stage runs npm ci --omit=dev from scratch, which triggers node-gyp on native deps (solana/eth signers) and fails the same way:

npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
ERROR: process "/bin/sh -c npm ci --omit=dev" did not complete successfully: exit code: 1

Fix

Drop dev-only deps in-place in the builder (npm prune --omit=dev — keeps the already-compiled native binaries) and COPY node_modules across to the runtime stage instead of reinstalling. node-gyp is never invoked again, runtime image base stays small (no python/toolchain there).

Test plan

  • CI LDS API DEV CI/CD builds and pushes lightningdotspacecom/lds-api:beta

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).
@TaprootFreak TaprootFreak marked this pull request as ready for review May 8, 2026 07:31
@TaprootFreak TaprootFreak merged commit 28fcd00 into develop May 8, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant