From 1e3195d547510d51804028d4ab447cbc53372e48 Mon Sep 17 00:00:00 2001 From: Ali Behnamfard Date: Mon, 6 Apr 2020 12:58:19 +0430 Subject: [PATCH] Update Dockerfile Run application with a non-root user inside docker. --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcd780e6..f5099872 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ -FROM node:12.13-alpine +FROM node:alpine -RUN mkdir -p /usr/src/node-app +RUN mkdir -p /usr/src/node-app && chown -R node:node /usr/src/node-app WORKDIR /usr/src/node-app COPY package.json yarn.lock ./ +USER node + RUN yarn install --pure-lockfile -COPY . . +COPY --chown=node:node . . EXPOSE 3000