Fix runner stage: copy full node_modules for Prisma CLI
Cherry-picking modules missed @prisma/engines and other required binaries. Copy the entire node_modules to runner to ensure prisma migrate deploy works correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-14
@@ -13,7 +13,7 @@ COPY . .
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
# Stage 3: Production runner (standalone)
|
||||
# Stage 3: Production runner
|
||||
FROM node:20-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
@@ -21,26 +21,16 @@ ENV NODE_ENV=production
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 nextjs
|
||||
|
||||
# Standalone output
|
||||
# Full app: standalone output + all deps for Prisma CLI migrations
|
||||
COPY --from=builder /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Prisma: migrations + generated client
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/src/generated ./src/generated
|
||||
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
||||
COPY --from=builder /app/tsconfig.json ./tsconfig.json
|
||||
|
||||
# Prisma CLI + adapters + pg driver for migrate deploy and runtime
|
||||
COPY --from=builder /app/node_modules/.bin/prisma /usr/local/bin/prisma
|
||||
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
|
||||
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
|
||||
COPY --from=builder /app/node_modules/dotenv ./node_modules/dotenv
|
||||
COPY --from=builder /app/node_modules/pg ./node_modules/pg
|
||||
COPY --from=builder /app/node_modules/pg-pool ./node_modules/pg-pool
|
||||
COPY --from=builder /app/node_modules/pg-protocol ./node_modules/pg-protocol
|
||||
COPY --from=builder /app/node_modules/pg-types ./node_modules/pg-types
|
||||
# Full node_modules needed for prisma CLI + all engine binaries
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
|
||||
COPY entrypoint.sh ./entrypoint.sh
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
Reference in New Issue
Block a user