docker: แก้ build ล้มที่ stage deps — postinstall หา scripts/patch-pdf-worker.mjs ไม่เจอ — เพิ่ม COPY scripts/patch-pdf-worker.mjs scripts/ ก่อน npm ci: Dockerfile เดิมคัดลอกแค่ package.json/package-lock.json แล้วสั่ง npm ci ทันที แต่ postinstall (node scripts/patch-pdf-worker.mjs ตาม invariant #6 — Docker build ต้องใช้ตัว patch ไม่ใช่ copyFileSync เปล่า) รันตอน npm ci ซึ่งไฟล์ script ยังไม่ถูกคัดลอกเข้า image (จะเข้าเองใน stage builder ผ่าน COPY . . ซึ่งช้ากว่า) → MODULE_NOT_FOUND exit 1 — คัดเฉพาะไฟล์เดียวไม่ทำลาย cache layer ของ dependencies (แก้ script อื่น migrate/seed-samples ไม่ต้อง install ใหม่) (คำขอผู้ใช้ 2026-09-25)
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 4s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 47s
Deploy eCourt Note Web to Server / Deploy eCourt Note Web to Server (push) Successful in 3s
Deploy eCourt Note Web to Server / Notify Deployment Status (push) Successful in 1s

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-09-25 13:35:36 +07:00
parent 882325b58a
commit c2ed9dabc1

View file

@ -2,6 +2,8 @@
FROM node:24-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
# postinstall รัน scripts/patch-pdf-worker.mjs ตอน npm ci — คัดลอกเข้ามาก่อน ไม่งั้นหาไฟล์ไม่เจอ
COPY scripts/patch-pdf-worker.mjs scripts/
# postinstall เขียน public/pdf.worker.min.mjs — ต้องมีโฟลเดอร์ public/ ก่อน ไม่งั้น npm ci ล้ม
RUN mkdir -p public && npm ci