From 64b8180d9ae6509c2fe078f350c52b6c3e2980f6 Mon Sep 17 00:00:00 2001 From: ginnoir Date: Wed, 6 May 2026 19:22:18 -0500 Subject: [PATCH] Fix migrate.mjs: explicitly copy full drizzle-orm and postgres into image The standalone tracer only includes subpaths the Next.js app imports. drizzle-orm/postgres-js/migrator is only used by migrate.mjs (not app code) so it is excluded from the trace. Copy the full packages from the builder stage to ensure all subpaths are available at startup. Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f65649..2583815 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,10 +32,14 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/public ./public -# Migration assets — drizzle/ holds SQL + meta journal; migrate.mjs uses -# drizzle-orm + postgres which Next.js standalone already traces in. +# Migration assets — drizzle/ holds SQL + meta journal; migrate.mjs runs +# at startup via the entrypoint. Explicitly copy the full drizzle-orm and +# postgres packages because the standalone tracer only includes subpaths +# the app itself imports, not the postgres-js/migrator subpath. COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle COPY --from=builder --chown=nextjs:nodejs /app/scripts/migrate.mjs ./scripts/migrate.mjs +COPY --from=builder --chown=nextjs:nodejs /app/node_modules/drizzle-orm ./node_modules/drizzle-orm +COPY --from=builder --chown=nextjs:nodejs /app/node_modules/postgres ./node_modules/postgres COPY --chown=nextjs:nodejs docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN chmod +x /usr/local/bin/docker-entrypoint.sh