Conversation
There was a problem hiding this comment.
Pull request overview
This PR appears to introduce an .npmrc and update the Docker build to use it, aiming to apply npm “best known configuration” (BKC) settings during container builds.
Changes:
- Add a new root-level
.npmrcwith npm config flags (includingignore-scripts=true) - Update
Dockerfileto copy.npmrcinto the build stage - Change Docker build dependency installation to
npm ci --ignore-scripts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Dockerfile | Copies .npmrc into the build stage and installs deps with scripts disabled |
| .npmrc | Adds npm configuration intended for hardened installs (e.g., ignoring scripts) |
| COPY package.json package-lock.json ./ | ||
| RUN npm ci | ||
| COPY package.json package-lock.json .npmrc ./ | ||
| RUN npm ci --ignore-scripts |
There was a problem hiding this comment.
npm ci --ignore-scripts will skip dependency install scripts needed for the build. This repo depends on esbuild which has hasInstallScript: true in package-lock.json (required to set up the platform binary), so the subsequent npm run build is very likely to fail at runtime. Consider allowing install scripts during the image build, or only disabling scripts selectively for known-safe scenarios rather than globally for the whole install step.
| RUN npm ci --ignore-scripts | |
| RUN npm ci |
| @@ -0,0 +1,3 @@ | |||
| ignore-scripts=true | |||
There was a problem hiding this comment.
Setting ignore-scripts=true at the repo root will disable install scripts for all npm install/ci runs (including local dev and CI). This project’s dependency tree includes packages like esbuild with hasInstallScript: true in package-lock.json, so globally ignoring scripts can break installs/builds. If the goal is a hardened CI setting, consider scoping this to the container/CI environment rather than committing it as a global .npmrc.
| ignore-scripts=true |
PR Checklist
What are you changing?
Anything the reviewer should know when reviewing this PR?
If the there are associated PRs in other repositories, please link them here (i.e. device-management-toolkit/repo#365 )