-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (33 loc) · 1.05 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
#########################
# INSTALAR DEPENDENCIAS #
#########################
FROM node:19-alpine As development
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN rm -rf node_modules && \
yarn config set "strict-ssl" false -g &&\
yarn install --frozen-lockfile
COPY --chown=node:node . .
USER node
############################
# COMPILAR PARA PRODUCCION #
############################
FROM node:19-alpine As build
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
COPY --chown=node:node . .
RUN yarn build
ENV NODE_ENV production
RUN yarn config set "strict-ssl" false -g &&\
yarn install --frozen-lockfile --production && \
yarn cache clean --all
USER node
######################
# EJECUTA APLICACION #
######################
FROM node:19-alpine As production
WORKDIR /app
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 [ "node", "dist/main.js" ]