Repository navigation
fix(docker): install npm in runtime stage so fresh-DB prisma migrate deploy works - #33657
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR fixes a container-startup crash where
Confidence Score: 5/5Safe to merge — the change is a single additional package in two identical The root-cause analysis is accurate, the fix is minimal and targeted, the regression test correctly isolates the runtime stage and validates both required packages, and the PR description includes concrete evidence of the crash and the fix. No logic changes, no new runtime code paths, no existing tests modified. No files require special attention.
|
| Filename | Overview |
|---|---|
| Dockerfile | Adds npm alongside existing nodejs in the runtime apk add call; well-commented explaining why the fallback nodeenv path breaks on Wolfi. |
| docker/Dockerfile.database | Identical one-package addition (npm) in the runtime stage, mirroring the fix in the root Dockerfile. |
| tests/test_litellm/test_dockerfile_runtime_prisma.py | New static regression guard that parses both Dockerfiles and asserts nodejs and npm are present in the runtime stage apk add; no network calls, no mocks. |
Reviews (1): Last reviewed commit: "fix(docker): install npm in runtime stag..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Relevant issues
Fixes #33650, fixes #24554
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Both runs use a brand-new empty Postgres and
HOME=/home/litellm(the released image runs as thelitellmuser, so its Prisma cache under/rootis never found and the CLI is bootstrapped at startup, which is what triggers the bug)Before, built from this branch with
npmremoved from the runtimeapk add(reproduces #33650 exactly):After, at commit 3154bb7:
Type
🐛 Bug Fix
Changes
The runtime stage of
Dockerfileanddocker/Dockerfile.databaseinstallednodejsbut deliberately left outnpm, on the assumption that runtime only ever runsprisma generateagainst binaries already cached from the builder stage. That assumption breaks forprisma migrate deployat container startup against a fresh database: prisma-python has to bootstrap the Node-based Prisma CLI, and its resolver picks the global Node/npm toolchain only when both are onPATH(use_global_nodedefaults toTrue). Withnpmabsent it falls back to nodeenv, which downloads a Node build (26.x) whose dynamic dependencylibatomic.so.1is not present in the Wolfi runtime image.nodethen exits 127, the migration silently fails, the proxy starts anyway with no schema, and every DB-backed endpoint 500s withThe table 'public.LiteLLM_TeamTable' does not existThe fix adds
npmback to the runtimeapk addin both Dockerfiles so prisma-python stays on the global-Node path and never invokes nodeenv at runtime. This mirrors whatmigrations/Dockerfilealready does withPRISMA_USE_GLOBAL_NODE=trueplusnodejs/npm, and completes the builder-stage fix from #28519/#28888 for the runtime half of the same bug class.docker/Dockerfile.non_rootis unaffected: it runs withPRISMA_OFFLINE_MODE=trueand executes the cached CLI directly via system Node, so it never reaches the nodeenv pathtests/test_litellm/test_dockerfile_runtime_prisma.pyis a static guard that parses the runtime stage of both Dockerfiles and fails ifnodejsornpmis dropped fromapk add, so this regression cannot silently returnFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/be13d5ae0bac48d7ad1e309d69070686