refactor(DOCKERFILE): rework to run properly as node user

This commit is contained in:
Asif Bacchus 2021-01-04 01:06:03 -07:00
parent 35523a1559
commit 75c15e9e43

View File

@ -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