Fix production Docker build (glibc/musl mismatch)#206
Merged
Conversation
The development stage installed node_modules on node:lts (Debian/glibc), which the Alpine (musl) build stage then copied. Native binaries (lightningcss, sharp, @next/swc) are libc-specific, so next build failed with "Cannot find module '*-musl.node'" once the dependency bump and the new CSS module actually loaded them. Also fixes the npm flag typo --omit:dev -> --omit=dev.
- comboObject was cast to a map over all Status keys but omitted Status.Self. Type it as Exclude<Status, Status.Self> instead of adding a Self entry: the render loop maps over Object.keys(comboObject) and comboColors has no Self entry, so rendering it would crash. - comboData[drugB] indexed the Interactions interface with a plain string; use keyof Interactions with a guard for the optional entries. Types only, no behavior change.
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.
Problem
The production build fails with:
Root cause
The
developmentstage installs node_modules onnode:lts(Debian, glibc), and thebuildstage (node:lts-alpine, musl) copies them over. Native binaries (lightningcss, sharp, @next/swc) are libc-specific, so the copied modules can't load on Alpine.This never surfaced before because the build didn't actually load these native modules. After the dependency bump (Next 15.5, Tailwind 4.3) and the new CSS module from #205, it does.
Fix
Use
node:lts-alpinefor the development stage too, so all stages share the same libc and copying node_modules between them stays valid.Also fixes a small npm flag typo:
--omit:dev->--omit=dev(it only worked by accident becauseNODE_ENV=productionalready omits dev deps).Also included
Two pre-existing type errors in
DrugInfo.tsxfailednext buildtype-checking after the Docker fix, so they're fixed here too (types only, no behavior change):comboObjectwas cast to a map over allStatuskeys but omittedStatus.Self. It's now typed asExclude<Status, Status.Self>instead of adding aSelfentry, because the render loop maps overObject.keys(comboObject)andcomboColorshas noSelfentry (rendering it would crash).comboData[drugB]indexed theInteractionsinterface with a plain string; now useskeyof Interactionswith a guard for the optional entries.Verified with
npx tsc --noEmit: 0 errors.