f0f13f22d9
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>
44 lines
1.2 KiB
Docker
44 lines
1.2 KiB
Docker
# Stage 1: Install all dependencies
|
|
FROM node:20-alpine AS deps
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Stage 2: Build
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
# Generate Prisma client before build
|
|
RUN npx prisma generate
|
|
RUN npm run build
|
|
|
|
# Stage 3: Production runner
|
|
FROM node:20-alpine AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
|
|
RUN addgroup --system --gid 1001 nodejs \
|
|
&& adduser --system --uid 1001 nextjs
|
|
|
|
# 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
|
|
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
|
|
# 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
|
|
|
|
USER nextjs
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["./entrypoint.sh"]
|