From 80dfba4059a8ef2f483d2da9f25ad13f49ac4359 Mon Sep 17 00:00:00 2001 From: Apipol Niyomsak Date: Sat, 22 Apr 2017 15:03:57 +0700 Subject: [PATCH] run as user --- Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 107577b..fe2bbd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,20 @@ FROM node:6-alpine LABEL maintainer "Apipol Niyomsak" -ARG PORT -ENV PORT=${PORT} \ - DEPLOY_DIR=/var/www/modcolle +ENV PORT=5000 \ + DEPLOY_DIR=/var/www/modcolle \ + USER=www -WORKDIR ${DEPLOY_DIR} ADD . ${DEPLOY_DIR} + +RUN adduser -S $USER && \ + chown -R $USER \ + $DEPLOY_DIR \ + /usr/local/lib \ + /usr/local/bin + +USER ${USER} +WORKDIR ${DEPLOY_DIR} RUN npm install --only=production -g pm2 && \ npm install && \ npm run build