From 8457c1becf68951d0abb1dfdd0decb3737e82907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ribeiro?= Date: Sat, 31 Dec 2022 14:22:59 -0300 Subject: [PATCH] :zap: reduce docker image size with multistage builds --- Dockerfile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b4a4635..ed7488f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:buster-slim +FROM node:buster-slim as builder WORKDIR /usr/app @@ -17,6 +17,20 @@ COPY . . RUN yarn build +FROM node:buster-slim + +WORKDIR /app + +RUN apt-get update && \ + apt-get install -y build-essential \ + wget \ + python3 \ + make \ + gcc \ + libc6-dev + +COPY --from=builder /usr/app /app/ + EXPOSE 3333 CMD ["yarn", "start"]