-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
24 lines (22 loc) · 875 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
# Multi-stage build
FROM node:19-alpine AS dependencies
WORKDIR /dependencies
COPY *.json /dependencies/
RUN npm install
FROM node:19-alpine AS builder
WORKDIR /buildapp
COPY --from=dependencies /dependencies/node_modules /buildapp/node_modules
COPY . /buildapp
RUN npm run build
FROM node:19-alpine AS app
WORKDIR /app
USER node
COPY --chown=node:node ./public /app/public
COPY --chown=node:node ./src /app/src
COPY --chown=node:node --from=builder /buildapp/node_modules /app/node_modules
COPY --chown=node:node --from=builder /buildapp/.next /app/.next
COPY --chown=node:node --from=builder /buildapp/public /app/public
COPY --chown=node:node --from=builder /buildapp/package.json /app/package.json
COPY --chown=node:node --from=builder /buildapp/src /app/src
COPY --chown=node:node --from=builder /buildapp/next.config.js /app/next.config.js
CMD ["npm", "run", "start"]