From 75c15e9e43bdc8339a1ba4fa93916181c0877952 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Mon, 4 Jan 2021 01:06:03 -0700 Subject: [PATCH] refactor(DOCKERFILE): rework to run properly as node user --- livereload/Dockerfile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/livereload/Dockerfile b/livereload/Dockerfile index e257d52..5e20621 100644 --- a/livereload/Dockerfile +++ b/livereload/Dockerfile @@ -12,12 +12,8 @@ RUN deluser --remove-home node \ && addgroup -g ${NODE_UID} -S node \ && adduser -G node -S -u ${NODE_UID} node -# add tini, timezone support and install livereload -WORKDIR /usr/local/livereload -RUN apk --update --no-cache add \ - tzdata \ - tini \ - && npm install livereload +# add tini, timezone support +RUN apk --update --no-cache add tzdata tini # create default volume in case user forgets to map one VOLUME [ "/var/watch" ] @@ -35,11 +31,14 @@ ENV EEXT="" ENV EXCLUDE=".git/,.svn/" ENV DELAY=500 +# install livereload for node user +USER node +WORKDIR /home/node +RUN npm install livereload # run node via tini by default -USER node ENTRYPOINT [ "/sbin/tini", "--" ] -CMD [ "livereload", "--port 9999", "--debug", "--exts $EXT", "--extraExts $EEXT", "--exclusions $EXCLUDE", "--wait $DELAY" ] +CMD [ "node", "livereload", "--port 9999", "--debug", "--exts $EXT", "--extraExts $EEXT", "--exclusions $EXCLUDE", "--wait $DELAY" ] # set build timestamp and version labels ARG BUILD_DATE