fix: work around npm optional-deps bug in frontend npm install

`npm ci` alone hits npm/cli#4828: optional platform-specific bindings
(e.g. @rolldown/binding-linux-arm64-gnu introduced by 1119's vite 5→8
upgrade) listed in package-lock.json for the lockfile author's
platform are not fetched for the build platform.  The sled rebuild
fails with `Cannot find native binding`.

Follow `npm ci` with `npm install --include=optional --no-save` so the
build platform's native binding is fetched without mutating the
lockfile.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-05-17 23:46:55 +01:00
parent 42e6eec9e9
commit c131896432
+8 -2
View File
@@ -46,8 +46,14 @@ WORKDIR /app
# build.rs) can produce the release binary with embedded frontend assets.
COPY . .
# Build frontend deps first (better layer caching)
RUN cd frontend && npm ci
# Build frontend deps first (better layer caching).
# `npm ci` alone hits npm's optional-dependencies bug (npm/cli#4828):
# platform-specific bindings (e.g. @rolldown/binding-linux-arm64-gnu)
# listed in package-lock.json for the lockfile author's platform are
# not installed for the build platform. Follow `npm ci` with a
# `--no-save --include=optional` install so the build platform's
# native binding is fetched without mutating the lockfile.
RUN cd frontend && npm ci && npm install --include=optional --no-save
# Build the release binary (build.rs runs npm run build for the frontend)
RUN cargo build --release \