From ced8e72a694a215a3d230788e86655bb054656b1 Mon Sep 17 00:00:00 2001 From: bukajsytlos Date: Mon, 18 Oct 2021 23:09:40 +0200 Subject: [PATCH] Run nodebb docker process under node user (#9913) Closes #9888 --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28d8586a48..80dce7cfb5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,20 @@ FROM node:lts -RUN mkdir -p /usr/src/app +RUN mkdir -p /usr/src/app && \ + chown -R node:node /usr/src/app WORKDIR /usr/src/app ARG NODE_ENV ENV NODE_ENV $NODE_ENV -COPY install/package.json /usr/src/app/package.json +COPY --chown=node:node install/package.json /usr/src/app/package.json + +USER node RUN npm install --only=prod && \ npm cache clean --force - -COPY . /usr/src/app + +COPY --chown=node:node . /usr/src/app ENV NODE_ENV=production \ daemon=false \