From 6ec0a82a92e36a86d99e8442a2a7247ec60daef0 Mon Sep 17 00:00:00 2001 From: Pierre Brisorgueil Date: Mon, 27 Apr 2020 22:24:02 +0200 Subject: [PATCH] =?UTF-8?q?feat(docker):=20review=20user=20to=20do=20nothi?= =?UTF-8?q?ng=20in=20root=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index b87458e83..f95b89e1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ FROM node:lts-slim -# Create app directory -WORKDIR /usr/src/app +# switch user +USER node -# Install app dependencies -COPY package*.json ./ -RUN npm install +# Create app directory +WORKDIR /home/node -# Bundle app source -COPY . . +# Install app dependencies & setup +COPY --chown=node:node package*.json ./ +RUN npm install --production +COPY --chown=node:node . . # Expose EXPOSE 80 443 3000 35729 8080 -# Command to run the executable +# Command to run CMD [ "node", "server.js" ] \ No newline at end of file