File tree Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Original file line number Diff line number Diff line change 1
- FROM node:14-alpine
1
+ FROM node:18-alpine AS base
2
+
3
+ RUN npm i -g pnpm
4
+
5
+ FROM base AS dependencies
6
+
7
+ COPY package*.json pnpm-lock.yaml ./
8
+
9
+ RUN pnpm install
10
+
11
+ FROM base AS builder
2
12
3
13
WORKDIR /app
4
14
5
- COPY package*.json yarn.lock* ./
15
+ COPY . .
16
+
17
+ COPY --from=dependencies /node_modules ./node_modules
18
+
19
+ RUN pnpm build
20
+
21
+ FROM builder AS prod
22
+
23
+ ENV NODE_ENV production
24
+
25
+ RUN addgroup --system --gid 1001 nodejs
26
+ RUN adduser --system --uid 1001 nextjs
27
+
28
+ COPY --from=builder /app/public ./public
29
+
30
+ RUN mkdir .next
31
+ RUN chown nextjs:nodejs .next
6
32
7
- RUN yarn
33
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
34
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
8
35
9
- COPY ./ ./
36
+ USER nextjs
10
37
11
- RUN yarn build
38
+ EXPOSE 3000
12
39
13
- CMD ["yarn ", "start"]
40
+ CMD ["pnpm ", "start"]
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ services:
6
6
build :
7
7
context : ../
8
8
dockerfile : docker/Dockerfile.prod
9
+ target : prod
9
10
restart : on-failure
10
11
ports :
11
12
- 3000:3000
You can’t perform that action at this time.
0 commit comments