Compare commits
No commits in common. "2c3bcf27d78c843266322b2b716199a56b9b1c17" and "9ee212fcef148c800d2aec2d0bef950713863e77" have entirely different histories.
2c3bcf27d7
...
9ee212fcef
@ -12,14 +12,17 @@ RUN deluser --remove-home node \
|
|||||||
&& adduser -G node -S -u ${NODE_UID} node
|
&& adduser -G node -S -u ${NODE_UID} node
|
||||||
|
|
||||||
# create default volumes in-case user forgets, expose default port
|
# create default volumes in-case user forgets, expose default port
|
||||||
VOLUME [ "/watch", "/certs" ]
|
VOLUME [ "/var/watch", "/var/certs" ]
|
||||||
EXPOSE 35729
|
EXPOSE 35729
|
||||||
|
|
||||||
# add tini, timezone support and create certificate directories
|
# add tini, timezone support and create certificate directories
|
||||||
RUN apk --update --no-cache add \
|
RUN apk --update --no-cache add \
|
||||||
tini \
|
tini \
|
||||||
tzdata \
|
tzdata \
|
||||||
openssl
|
openssl \
|
||||||
|
&& chown node:node /var/certs \
|
||||||
|
&& chmod 700 /var/certs \
|
||||||
|
&& chmod +r /var/watch
|
||||||
|
|
||||||
# labels
|
# labels
|
||||||
LABEL org.opencontainers.image.authors="Asif Bacchus <asif@asifbacchus.dev>"
|
LABEL org.opencontainers.image.authors="Asif Bacchus <asif@asifbacchus.dev>"
|
||||||
@ -39,7 +42,12 @@ ENV LR_EXTS="html,xml,css,js,jsx,ts,tsx,php,py"
|
|||||||
ENV LR_EXCLUDE=".git/,.svn/,.vscode/,.idea/"
|
ENV LR_EXCLUDE=".git/,.svn/,.vscode/,.idea/"
|
||||||
ENV LR_DELAY=500
|
ENV LR_DELAY=500
|
||||||
|
|
||||||
# install livereload npm as node user then switch back to root user
|
# copy scripts, cleanup permissions and install livereload npm
|
||||||
|
COPY [ "livereload.js", "/home/node/livereload.js" ]
|
||||||
|
COPY [ "entrypoint.sh", "/usr/local/bin/entrypoint.sh" ]
|
||||||
|
RUN chown node:node /home/node/livereload.js \
|
||||||
|
&& chmod 644 /home/node/livereload.js \
|
||||||
|
&& chmod 755 /usr/local/bin/entrypoint.sh
|
||||||
USER node
|
USER node
|
||||||
WORKDIR /home/node
|
WORKDIR /home/node
|
||||||
RUN mkdir -p .npm-global/bin .npm-global/lib \
|
RUN mkdir -p .npm-global/bin .npm-global/lib \
|
||||||
@ -47,27 +55,16 @@ RUN mkdir -p .npm-global/bin .npm-global/lib \
|
|||||||
&& npm config set update-notifier false \
|
&& npm config set update-notifier false \
|
||||||
&& npm install livereload --save
|
&& npm install livereload --save
|
||||||
|
|
||||||
# copy scripts and fix-up all permissions
|
# run entrypoint script by default
|
||||||
USER root
|
|
||||||
COPY [ "livereload.js", "/home/node/livereload.js" ]
|
|
||||||
COPY [ "entrypoint.sh", "/usr/local/bin/entrypoint.sh" ]
|
|
||||||
RUN chown node:node /home/node/livereload.js \
|
|
||||||
&& chmod 644 /home/node/livereload.js \
|
|
||||||
&& chmod 755 /usr/local/bin/entrypoint.sh
|
|
||||||
|
|
||||||
# switch to node user, run entrypoint script by default
|
|
||||||
USER node
|
|
||||||
WORKDIR /home/node
|
|
||||||
ENTRYPOINT [ "/sbin/tini", "--", "/usr/local/bin/entrypoint.sh" ]
|
ENTRYPOINT [ "/sbin/tini", "--", "/usr/local/bin/entrypoint.sh" ]
|
||||||
|
|
||||||
# set build timestamp and version labels
|
# set build timestamp and version labels
|
||||||
# TODO: uncomment when done testing
|
ARG INTERNAL_VERSION
|
||||||
#ARG INTERNAL_VERSION
|
ARG BUILD_DATE
|
||||||
#ARG BUILD_DATE
|
LABEL org.opencontainers.image.version="16.5.0, 0.9.3"
|
||||||
#LABEL org.opencontainers.image.version="16.5.0, 0.9.3"
|
LABEL org.opencontainers.image.vendor="NODE.js, node-livereload"
|
||||||
#LABEL org.opencontainers.image.vendor="NODE.js, node-livereload"
|
LABEL dev.asifbacchus.image.name="livereload-tls-npm"
|
||||||
#LABEL dev.asifbacchus.image.name="livereload-tls-npm"
|
LABEL dev.asifbacchus.image.version=${INTERNAL_VERSION}
|
||||||
#LABEL dev.asifbacchus.image.version=${INTERNAL_VERSION}
|
LABEL org.opencontainers.image.created=${BUILD_DATE}
|
||||||
#LABEL org.opencontainers.image.created=${BUILD_DATE}
|
|
||||||
|
|
||||||
#EOF
|
#EOF
|
||||||
|
@ -33,9 +33,8 @@ case "$1" in
|
|||||||
listen | server | run | start)
|
listen | server | run | start)
|
||||||
doServer=1
|
doServer=1
|
||||||
;;
|
;;
|
||||||
shell)
|
shell) ;;
|
||||||
doShell=1
|
|
||||||
;;
|
|
||||||
new-cert)
|
new-cert)
|
||||||
doCertNew=1
|
doCertNew=1
|
||||||
;;
|
;;
|
||||||
@ -48,27 +47,20 @@ export-cert)
|
|||||||
*)
|
*)
|
||||||
# invalid or unknown option
|
# invalid or unknown option
|
||||||
printf "\nUnknown action requested: %s\n" "$1"
|
printf "\nUnknown action requested: %s\n" "$1"
|
||||||
printf "Valid actions: [listen | server | run | start] | shell | new-cert | show-cert | export-cert\n\n"
|
printf "Valid actions: [listen | server | run | start] | shell | new-cert | show-cert | export-cert"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# action: run server
|
# action: run server
|
||||||
if [ "$doServer" -eq 1 ]; then
|
if [ "$doServer" -eq 1 ]; then
|
||||||
exec node livereload.js
|
exec "node livereload.js"
|
||||||
exit "$?"
|
exit "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# action: drop to shell
|
# action: drop to shell
|
||||||
if [ "$doShell" -eq 1 ]; then
|
if [ "$doShell" -eq 1 ]; then
|
||||||
if [ -z "$2" ]; then
|
exec /bin/sh "$@"
|
||||||
printf "\nExecuting interactive shell:\n"
|
|
||||||
exec /bin/sh
|
|
||||||
else
|
|
||||||
shift
|
|
||||||
printf "\nExecuting shell: '%s'\n" "$*"
|
|
||||||
exec /bin/sh -c "$*"
|
|
||||||
fi
|
|
||||||
exit "$?"
|
exit "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user