From 9aab716dc9344421537a6f64c586442559c45dd8 Mon Sep 17 00:00:00 2001 From: Guilherme Rauen <33286139+guilherme-rauen@users.noreply.github.com> Date: Wed, 29 Jun 2022 14:33:08 +0200 Subject: [PATCH] Snyk Security Issues (#46) * improve dockerfile and fix snyk security issues * enable build in arm64 machine Co-authored-by: Guilherme Rauen --- Dockerfile | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 879313b..3577cc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,23 @@ -FROM node:lts-slim +FROM --platform=linux/amd64 node:16.15.1-alpine as base + +RUN apk --update --no-cache add --virtual .builds-deps build-base python3 + WORKDIR /opt/app/ -COPY package.json ./ -RUN npm install -RUN npm prune -COPY . /opt/app + +FROM base as build + +COPY package.json package-lock.json ./ + +RUN npm ci + +COPY . . + +FROM base + +COPY --from=build /opt/app /opt/app/ + ARG NODE_ENV + ENV NODE_ENV $NODE_ENV -CMD [ "npm", "start" ] +CMD [ "node", "app.js" ] \ No newline at end of file