30 lines
801 B
Docker
30 lines
801 B
Docker
FROM node:20-alpine AS base
|
|
WORKDIR /app
|
|
|
|
FROM base AS deps
|
|
COPY package.json package-lock.json ./
|
|
COPY prisma ./prisma
|
|
RUN npm ci
|
|
|
|
FROM base AS builder
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN npx prisma generate
|
|
RUN npm run build
|
|
|
|
FROM base AS runner
|
|
ENV NODE_ENV=production
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/.next ./.next
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder /app/package.json ./package.json
|
|
COPY --from=builder /app/next.config.ts ./next.config.ts
|
|
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
|
|
COPY --from=builder /app/prisma ./prisma
|
|
COPY docker-entrypoint.sh ./docker-entrypoint.sh
|
|
RUN chmod +x ./docker-entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
|
CMD ["npm", "start"]
|