The postinstall script runs prisma generate, but the prisma schema files aren't available in the deps stage (only package.json is copied). The builder stage already runs prisma generate after copying all files. Made-with: Cursor
44 lines
1 KiB
Docker
44 lines
1 KiB
Docker
FROM node:24-slim AS base
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
graphicsmagick \
|
|
ghostscript \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
FROM base AS deps
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --ignore-scripts
|
|
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
RUN npx prisma generate && npm run build
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
RUN groupadd --system --gid 1001 nodejs
|
|
RUN useradd --system --uid 1001 nextjs
|
|
|
|
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 --from=builder /app/prisma ./prisma
|
|
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
|
|
|
RUN mkdir -p /data/watch && chown -R nextjs:nodejs /data
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|