Include Prisma CLI in production image for migrations
Build and Push Docker Image / lint-and-typecheck (push) Successful in 1m44s Details
Build and Push Docker Image / build (push) Successful in 4m9s Details

Copy prisma CLI and its node_modules folder to allow running
migrations in the container with ./node_modules/.bin/prisma

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-01-17 14:54:50 +01:00
parent d378fd7439
commit d05b612c11
1 changed files with 3 additions and 1 deletions

View File

@ -61,9 +61,11 @@ RUN chown nextjs:nodejs .next
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Copy Prisma
# Copy Prisma (client, CLI, and config)
COPY --from=deps /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=deps /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=deps /app/node_modules/prisma ./node_modules/prisma
COPY --from=deps /app/node_modules/.bin/prisma ./node_modules/.bin/prisma
COPY prisma ./prisma/
USER nextjs