-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (28 loc) · 944 Bytes
/
Dockerfile
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
# https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile
FROM node:20-slim AS base
FROM base AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
# TODO fix: use this layer will cause "Cannot find package buffer-polyfill"
# Setup production node_modules
# FROM base as production-deps
# WORKDIR /app
# COPY --from=deps /app/node_modules ./node_modules
# COPY package.json package-lock.json ./
# RUN npm prune --omit=dev
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM base AS runtime
WORKDIR /app
# COPY --from=production-deps /app/node_modules ./node_modules
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY --from=builder /app/build/server ./build/server
COPY --from=builder /app/build/client ./build/client
ENV NODE_ENV production
EXPOSE 3000
CMD ["npm", "run","start"]