Repository navigation
[Urgent] fix: include npm config in Docker install layer - #1630
diegosouzapw merged 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the Dockerfile to include the .npmrc file and cleans up a duplicate COPY instruction. The review feedback highlights security and portability concerns regarding the inclusion of .npmrc and recommends using an environment variable for npm configuration instead.
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY package*.json ./ | ||
| COPY .npmrc ./ |
There was a problem hiding this comment.
Copying .npmrc into the Docker image is generally discouraged for two reasons:
- Security: If the file contains sensitive information (such as authentication tokens for private registries), it will be baked into the image layers, creating a security risk even if the file is not present in the final stage.
- Portability: If
.npmrcis not checked into the repository (which is common for local or environment-specific configurations), thedocker buildcommand will fail for other developers or in CI environments with a "file not found" error.
Since the stated goal is to enable legacy-peer-deps=true, it is safer and more robust to use an environment variable. This achieves the same result without requiring an external file and ensures the build is self-contained.
ENV NPM_CONFIG_LEGACY_PEER_DEPS=true
There was a problem hiding this comment.
Pull request overview
Fixes Docker image builds by ensuring npm’s install-time configuration is present in the cached dependency-install layer.
Changes:
- Copy
.npmrcinto the builder stage before runningnpm ci/npm install, so installs respectlegacy-peer-deps=true. - Remove a duplicate
COPYofscripts/postinstallSupport.mjsin the same layer.
1c86cd5
into
cheaper-inference:release/v3.7.1
|
Thanks @rdself for catching this Docker build issue! The fix has been squash-merged into |
…cleanup), fix test regression - PR #1630: Set NPM_CONFIG_LEGACY_PEER_DEPS=true in Dockerfile, remove duplicate COPY - PR #1631: Hide deprecated gemini-claude-* models from catalogs, redirect to Claude 4.6 - Fix provider-models-route test to match renamed model display name - Update CHANGELOG.md with both PR entries
cheaper-inference#1630) Cherry-pick from PR cheaper-inference#1630 by @rdself. Fixes Docker build failures caused by lockfile peer dependency mismatch during npm ci.
…erence#1630) fix: include NPM_CONFIG_LEGACY_PEER_DEPS in Docker builder layer — integrated into release/v3.7.1
…inference#1631 (Antigravity model cleanup), fix test regression - PR cheaper-inference#1630: Set NPM_CONFIG_LEGACY_PEER_DEPS=true in Dockerfile, remove duplicate COPY - PR cheaper-inference#1631: Hide deprecated gemini-claude-* models from catalogs, redirect to Claude 4.6 - Fix provider-models-route test to match renamed model display name - Update CHANGELOG.md with both PR entries
cheaper-inference#1630) Cherry-pick from PR cheaper-inference#1630 by @rdself. Fixes Docker build failures caused by lockfile peer dependency mismatch during npm ci.
…erence#1630) fix: include NPM_CONFIG_LEGACY_PEER_DEPS in Docker builder layer — integrated into release/v3.7.1
…inference#1631 (Antigravity model cleanup), fix test regression - PR cheaper-inference#1630: Set NPM_CONFIG_LEGACY_PEER_DEPS=true in Dockerfile, remove duplicate COPY - PR cheaper-inference#1631: Hide deprecated gemini-claude-* models from catalogs, redirect to Claude 4.6 - Fix provider-models-route test to match renamed model display name - Update CHANGELOG.md with both PR entries
Summary
NPM_CONFIG_LEGACY_PEER_DEPS=trueinside the Docker builder beforenpm ciruns.postinstallSupport.mjscopy in the dependency install layer.Impact
Root Cause
The release lockfile relies on npm legacy peer dependency resolution to avoid installing unused
@lobehub/iconspeer packages. The Docker build did not provide that npm config beforenpm ci, so npm attempted to resolve the peer dependency tree and failed with lockfile sync errors for@lobehub/ui,antd,lucide-react, and related packages.Validation
git diff --checkNPM_CONFIG_LEGACY_PEER_DEPS=true npm ci --ignore-scripts --dry-run --no-audit --no-fundsucceeds in a clean temp directory without copying.npmrc.Docker daemon was not available locally, so the full image build is left to CI.