Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (42 loc) · 1.78 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (42 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# This template uses Automatically Copying Traced Files feature
# so you need to setup your Next Config file to use `output: 'standalone'`
# Please read this for more information https://nextjs.org/docs/pages/api-reference/next-config-js/output
FROM node:24-alpine AS builder
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /build
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat openssl
# Install the pinned pnpm with npm rather than corepack (older corepack versions cannot run pnpm 12)
RUN npm install -g pnpm@12.14.0
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml prisma.config.ts ./
COPY prisma ./prisma
# postinstall runs `prisma generate` (the client is needed for the build)
RUN pnpm install --frozen-lockfile
COPY . .
# Build the collection code
RUN pnpm build
# Production image, copy all the files and run next
FROM node:24-alpine AS runner
RUN apk add --no-cache dumb-init openssl
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
WORKDIR /app
# Set the correct permission for prerender cache
RUN mkdir /app/.next
RUN chown node:node /app/.next
COPY --from=builder /build/next.config.js ./
COPY --from=builder /build/public ./public
COPY --from=builder /build/.next/standalone ./
COPY --from=builder /build/.next/static ./.next/static
COPY --from=builder /build/entry.sh ./entry.sh
COPY --from=builder --chown=node:node /build/prisma ./prisma
# RUN npm i sharp
RUN chown -R node:node .
USER node
EXPOSE 3000
# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry.
ENV NEXT_TELEMETRY_DISABLED=1
CMD ["./entry.sh"]