fix(docker): copy scripts/ before npm install; skip postinstall in deploy stage
The postinstall hook (scripts/postinstall.mjs) runs during `npm install`, but the Dockerfile only copied package*.json before that step, so the script wasn't present. - Copy scripts/ alongside package*.json in the builder stage. - Add --ignore-scripts to the deploy-stage npm install: flowbite-svelte is a devDependency and won't be installed there, so the postinstall patch is irrelevant and the script file won't be available in that stage anyway. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,9 @@ FROM node:24-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first for better Docker layer caching.
|
||||
# scripts/ must be copied before npm install because postinstall.mjs runs during install.
|
||||
COPY package*.json ./
|
||||
COPY scripts/ ./scripts/
|
||||
RUN npm install
|
||||
|
||||
# Copy the rest of the source code.
|
||||
@@ -47,7 +49,9 @@ COPY --from=builder /app/package.json .
|
||||
COPY --from=builder /app/package-lock.json .
|
||||
|
||||
# Install only production dependencies.
|
||||
RUN npm install --omit=dev
|
||||
# --ignore-scripts skips postinstall (which patches flowbite-svelte dist files);
|
||||
# flowbite-svelte is a devDependency and won't be installed here anyway.
|
||||
RUN npm install --omit=dev --ignore-scripts
|
||||
|
||||
# Copy the runtime env file (non-PUBLIC vars for the Node server).
|
||||
COPY --from=builder /app/.env.runtime .env
|
||||
|
||||
Reference in New Issue
Block a user