-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (23 loc) · 889 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
37
38
39
40
41
FROM node:19.1.0-alpine AS development
USER node
WORKDIR /usr/src/app
COPY --chown=node:node ./package.json ./
COPY --chown=node:node ./yarn.lock ./
RUN yarn install --immutable --immutable-cache --check-cache
COPY --chown=node:node . .
FROM node:19.1.0-alpine as build
USER node
WORKDIR /usr/src/app
COPY --chown=node:node ./package.json ./
COPY --chown=node:node ./yarn.lock ./
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
COPY --chown=node:node . .
RUN yarn build
RUN yarn install --immutable --immutable-cache --check-cache --production && yarn cache clean
FROM node:19.1.0-alpine as production
USER node
WORKDIR /usr/src/app
COPY --chown=node:node ./package.json ./
COPY --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
COPY --chown=node:node --from=build /usr/src/app/dist ./dist
CMD [ "yarn", "start" ]