From ec26d79f0e93c647bbdcbc2685c6879b8ce17f4b Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 10 Sep 2026 16:30:01 +0700 Subject: [PATCH] =?UTF-8?q?Fix=20migrate=20=E0=B8=95=E0=B8=AD=E0=B8=99=20s?= =?UTF-8?q?tart:=20standalone=20node=5Fmodules=20=E0=B9=84=E0=B8=A1?= =?UTF-8?q?=E0=B9=88=E0=B8=A1=E0=B8=B5=20package=20postgres?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- docker/web.Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/web.Dockerfile b/docker/web.Dockerfile index 26e00ba..5963fbb 100644 --- a/docker/web.Dockerfile +++ b/docker/web.Dockerfile @@ -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)