-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (36 loc) · 1.13 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM node:18-alpine as builder
RUN apk add --update --no-cache curl git openssh openssl
USER node
WORKDIR /home/node
COPY --chown=node:node package*.json ./
COPY --chown=node:node yarn.lock ./
RUN yarn install --frozen-lockfile
COPY --chown=node:node . .
ARG NODE_ENV=production
ARG APP_ENV=production
ENV NODE_ENV ${NODE_ENV}
RUN ["yarn", "build"]
FROM node:18-alpine as prod-deps
USER node
WORKDIR /home/node
# copy from build image
COPY --from=builder /home/node/yarn.lock ./yarn.lock
COPY --from=builder /home/node/package.json ./package.json
RUN yarn install --frozen-lockfile --prod
ARG NODE_ENV=production
ARG APP_ENV=production
ENV NODE_ENV ${NODE_ENV}
CMD [ "node", "dist/main" ]
FROM node:18-alpine as production
USER node
WORKDIR /home/node
# copy from build image
COPY --from=prod-deps /home/node/node_modules ./node_modules
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/yarn.lock ./yarn.lock
COPY --from=builder /home/node/package.json ./package.json
RUN yarn install --frozen-lockfile --prod
ARG NODE_ENV=production
ARG APP_ENV=production
ENV NODE_ENV ${NODE_ENV}
CMD [ "node", "dist/main" ]