forked from fga-eps-mds/2024-1-GEROcuidado-APIUsuario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
44 lines (23 loc) · 878 Bytes
/
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
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
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 3001
ENTRYPOINT ["/app/entrypoint.sh"]