Fix migrate ตอน start: standalone node_modules ไม่มี package postgres
All checks were successful
Deploy eCourt Note Web to Server / Validate Database Schema (Drizzle) (push) Successful in 3s
Deploy eCourt Note Web to Server / Build Web Docker Image (push) Successful in 46s
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

Next บีบ bundle postgres.js เข้า server chunks ทำให้ /app/node_modules
ของ standalone ไม่มี package นี้ — migrate.mjs import ไม่เจอ (ERR_MODULE_NOT_FOUND)
แก้โดย COPY package postgres จาก stage deps (v3.4.9 ไม่มี dependency ย่อย)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-09-10 16:30:01 +07:00
parent 60658568f7
commit ec26d79f0e

View file

@ -34,6 +34,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# migration: ไฟล์ SQL (drizzle-kit generate) + runner — รันตอน container start
COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle
COPY --from=builder --chown=nextjs:nodejs /app/scripts ./scripts
# postgres.js โดน Next บีบ bundle เข้า server chunks — standalone node_modules ไม่มี package นี้
# แต่ migrate.mjs import มันตรง ๆ → คัดลอกจาก stage deps (v3 ไม่มี dependency ย่อย โฟลเดอร์เดียวพอ)
COPY --from=deps --chown=nextjs:nodejs /app/node_modules/postgres ./node_modules/postgres
USER nextjs
EXPOSE 3000
# DATABASE_URL ฉีดตอนรันผ่าน env ของ container (อย่าฝังใน image)