From b781c83545123b9da89263021f8bd94d5437f465 Mon Sep 17 00:00:00 2001 From: Guilherme Oliveira Date: Fri, 15 Dec 2023 14:46:31 -0300 Subject: [PATCH] Dockerfile modified to use multi-stage build --- Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f906ad0..cf9bccf4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20.7.0-alpine +FROM node:20.7.0-alpine AS builder LABEL version="1.6.1" description="Api to control whatsapp features through http requests." LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes" @@ -11,6 +11,14 @@ WORKDIR /evolution COPY ./package.json . +RUN npm install + +COPY . . + +RUN npm run build + +FROM node:20.7.0-alpine AS final + ENV TZ=America/Sao_Paulo ENV DOCKER_ENV=true @@ -126,10 +134,8 @@ ENV AUTHENTICATION_INSTANCE_CHATWOOT_ACCOUNT_ID=1 ENV AUTHENTICATION_INSTANCE_CHATWOOT_TOKEN=123456 ENV AUTHENTICATION_INSTANCE_CHATWOOT_URL= -RUN npm install +WORKDIR /evolution -COPY . . - -RUN npm run build +COPY --from=builder /evolution . CMD [ "node", "./dist/src/main.js" ]