@@ -6,42 +6,48 @@ FROM base AS deps
6
6
RUN apk add --no-cache libc6-compat
7
7
WORKDIR /app
8
8
9
- # Install dependencies based on the preferred package manager
10
- COPY package.json pnpm-lock.yaml ./
11
9
12
- # Install pnpm
13
- RUN npm install -g pnpm
10
+ # Prisma stuff
11
+ COPY prisma ./prisma
14
12
15
- COPY . .
13
+ # Install dependencies
14
+ COPY package.json pnpm-lock.yaml* .env ./
15
+ RUN pnpm i --frozen-lockfile
16
16
17
- # Install dependencies using pnpm
18
- RUN pnpm install
19
17
20
18
# Rebuild the source code only when needed
21
19
FROM base AS builder
20
+ WORKDIR /app
22
21
COPY --from=deps /app/node_modules ./node_modules
23
22
COPY . .
24
23
25
- RUN npm install -g pnpm
26
-
27
- RUN pnpm -v
24
+ # Next.js collects completely anonymous telemetry data about general usage.
25
+ # Learn more here: https://nextjs.org/telemetry
26
+ # Uncomment the following line in case you want to disable telemetry during the build.
27
+ # ENV NEXT_TELEMETRY_DISABLED 1
28
28
29
29
RUN pnpm run build
30
30
31
+ # If using npm comment out above and use below instead
32
+ # RUN npm run build
33
+
31
34
# Production image, copy all the files and run next
32
35
FROM base AS runner
33
36
WORKDIR /app
34
37
35
38
ENV NODE_ENV production
36
-
37
39
# Uncomment the following line in case you want to disable telemetry during runtime.
38
40
# ENV NEXT_TELEMETRY_DISABLED 1
39
41
40
42
RUN addgroup --system --gid 1001 nodejs
41
43
RUN adduser --system --uid 1001 nextjs
42
44
43
45
COPY --from=builder /app/public ./public
44
- COPY --from=builder /app/package.json ./package.json
46
+
47
+ # Set the correct permission for prerender cache
48
+ RUN mkdir .next
49
+ RUN chown nextjs:nodejs .next
50
+
45
51
# Automatically leverage output traces to reduce image size
46
52
# https://nextjs.org/docs/advanced-features/output-file-tracing
47
53
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
@@ -52,5 +58,7 @@ USER nextjs
52
58
EXPOSE 3000
53
59
54
60
ENV PORT 3000
61
+ # set hostname to localhost
62
+ ENV HOSTNAME "0.0.0.0"
55
63
56
64
CMD ["node" , "server.js" ]
0 commit comments