refactor(DOCKERFILE): rework to run properly as node user
This commit is contained in:
parent
35523a1559
commit
75c15e9e43
@ -12,12 +12,8 @@ RUN deluser --remove-home node \
|
|||||||
&& addgroup -g ${NODE_UID} -S node \
|
&& addgroup -g ${NODE_UID} -S node \
|
||||||
&& adduser -G node -S -u ${NODE_UID} node
|
&& adduser -G node -S -u ${NODE_UID} node
|
||||||
|
|
||||||
# add tini, timezone support and install livereload
|
# add tini, timezone support
|
||||||
WORKDIR /usr/local/livereload
|
RUN apk --update --no-cache add tzdata tini
|
||||||
RUN apk --update --no-cache add \
|
|
||||||
tzdata \
|
|
||||||
tini \
|
|
||||||
&& npm install livereload
|
|
||||||
|
|
||||||
# create default volume in case user forgets to map one
|
# create default volume in case user forgets to map one
|
||||||
VOLUME [ "/var/watch" ]
|
VOLUME [ "/var/watch" ]
|
||||||
@ -35,11 +31,14 @@ ENV EEXT=""
|
|||||||
ENV EXCLUDE=".git/,.svn/"
|
ENV EXCLUDE=".git/,.svn/"
|
||||||
ENV DELAY=500
|
ENV DELAY=500
|
||||||
|
|
||||||
|
# install livereload for node user
|
||||||
|
USER node
|
||||||
|
WORKDIR /home/node
|
||||||
|
RUN npm install livereload
|
||||||
|
|
||||||
# run node via tini by default
|
# run node via tini by default
|
||||||
USER node
|
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
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
|
# set build timestamp and version labels
|
||||||
ARG BUILD_DATE
|
ARG BUILD_DATE
|
||||||
|
Loading…
Reference in New Issue
Block a user