-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 803 Bytes
/
Copy pathDockerfile
File metadata and controls
45 lines (32 loc) · 803 Bytes
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
FROM node:18.17.0-alpine as builder
ENV NODE_ENV build
USER node
WORKDIR /home/node
COPY yarn.lock yarn.lock
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false \
--ignore-script
COPY --chown=node:node . .
RUN yarn build
RUN rm -rf node_modules
ENV NODE_ENV=production
RUN yarn install \
--prefer-offline \
--pure-lockfile \
--non-interactive \
--production=true
# ---
FROM node:18.17.0-alpine
ENV NODE_ENV production
USER node
WORKDIR /home/node
COPY --from=builder --chown=node:node /home/node/package*.json ./
COPY --from=builder --chown=node:node /home/node/node_modules/ ./node_modules/
COPY --from=builder --chown=node:node /home/node/dist/ ./dist/
ENV HOST 0.0.0.0
ENV PORT 80
EXPOSE ${PORT}
CMD ["node", "dist/main.js"]