generated from HenriqueAmorim20/GEROcuidadoAPITemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.prod
53 lines (29 loc) · 1.04 KB
/
Dockerfile.prod
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
FROM node:18.17.0-alpine AS BUILD_IMAGE
RUN apk update && apk add curl bash make && rm -rf /var/cache/apk/*
WORKDIR /home/node/app
RUN npm i -g @nestjs/[email protected]
COPY package*.json ./
RUN npm ci --legacy-peer-deps
COPY . .
RUN npm run build
FROM node:18.17.0-alpine AS BUILD_NODE_MODULES
RUN apk update && apk add curl bash make && rm -rf /var/cache/apk/*
WORKDIR /home/node/app
COPY package*.json ./
RUN npm ci --legacy-peer-deps --omit=dev
FROM node:18.17.0-alpine
ENV NODE_ENV=production
ARG TZ='America/Sao_Paulo'
ENV TZ ${TZ}
RUN apk upgrade --update
RUN apk add --no-cache tzdata openssl
RUN cp /usr/share/zoneinfo/${TZ} /etc/localtime
RUN echo "${TZ}" > /etc/timezone
WORKDIR /app
COPY --chown=node:node --from=BUILD_IMAGE /home/node/app/dist /app
COPY --chown=node:node --from=BUILD_NODE_MODULES /home/node/app/node_modules /app/node_modules
COPY --chown=node:node --from=BUILD_IMAGE /home/node/app/.docker/entrypoint.prod.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
USER node
EXPOSE 3003
ENTRYPOINT ["/app/entrypoint.sh"]