Fix Docker image: add prisma + dotenv to runner stage
The standalone Next.js output doesn't include prisma (devDependency) or dotenv (only used by prisma.config.ts, not app runtime). Install them explicitly in the runner stage for prisma migrate deploy. Pin prisma@7.4.2 to avoid npx downloading a non-existent version. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
449b248323
commit
005a7acbe2
1 changed files with 6 additions and 2 deletions
|
|
@ -37,10 +37,14 @@ COPY --from=builder /app/public ./public
|
|||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
# Copy Prisma schema and migrations for runtime
|
||||
# Copy Prisma schema, config, and migrations for runtime
|
||||
COPY --from=builder /app/prisma ./prisma
|
||||
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
||||
COPY --from=builder /app/src/generated ./src/generated
|
||||
|
||||
# Install prisma + dotenv for migrate deploy (prisma.config.ts imports dotenv/config)
|
||||
RUN npm install --no-save prisma@7.4.2 dotenv@17.3.1
|
||||
|
||||
# Create uploads directory for video/media storage (mounted as volume)
|
||||
RUN mkdir -p /data/uploads && chown nextjs:nodejs /data/uploads
|
||||
|
||||
|
|
@ -51,4 +55,4 @@ EXPOSE 3000
|
|||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
CMD ["sh", "-c", "npx prisma migrate deploy && node server.js"]
|
||||
CMD ["sh", "-c", "./node_modules/.bin/prisma migrate deploy && node server.js"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue