Skip to content

Commit 42ae7d1

Browse files
Merge pull request #286 from gomessguii/feature/dockerfile-optimization
Dockerfile modified to use multi-stage build
2 parents e48cea1 + b781c83 commit 42ae7d1

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20.7.0-alpine
1+
FROM node:20.7.0-alpine AS builder
22

33
LABEL version="1.6.1" description="Api to control whatsapp features through http requests."
44
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
@@ -11,6 +11,14 @@ WORKDIR /evolution
1111

1212
COPY ./package.json .
1313

14+
RUN npm install
15+
16+
COPY . .
17+
18+
RUN npm run build
19+
20+
FROM node:20.7.0-alpine AS final
21+
1422
ENV TZ=America/Sao_Paulo
1523
ENV DOCKER_ENV=true
1624

@@ -126,10 +134,8 @@ ENV AUTHENTICATION_INSTANCE_CHATWOOT_ACCOUNT_ID=1
126134
ENV AUTHENTICATION_INSTANCE_CHATWOOT_TOKEN=123456
127135
ENV AUTHENTICATION_INSTANCE_CHATWOOT_URL=<url>
128136

129-
RUN npm install
130-
131-
COPY . .
137+
WORKDIR /evolution
132138

133-
RUN npm run build
139+
COPY --from=builder /evolution .
134140

135141
CMD [ "node", "./dist/src/main.js" ]

0 commit comments

Comments
 (0)