diff --git a/16/Dockerfile b/16/Dockerfile new file mode 100644 index 0000000..2a5c7a9 --- /dev/null +++ b/16/Dockerfile @@ -0,0 +1,19 @@ +FROM repository.anxinyun.cn/devops/alpine:3-tz-hw + +ENV NODE_VERSION 16.14.2 + +RUN addgroup -g 1000 node \ + && adduser -u 1000 -G node -s /bin/sh -D node \ + && apk add --no-cache nodejs==16.14.2-r0 npm yarn \ + && node --version \ + && npm --version \ + && yarn --version \ + && npm config set registry https://registry.npm.taobao.org + +COPY docker-entrypoint.sh /usr/local/bin/ + +USER node + +ENTRYPOINT ["docker-entrypoint.sh"] + +CMD [ "node" ] diff --git a/16/docker-entrypoint.sh b/16/docker-entrypoint.sh new file mode 100644 index 0000000..1b3116e --- /dev/null +++ b/16/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Run command with node if the first argument contains a "-" or is not a system command. The last +# part inside the "{}" is a workaround for the following bug in ash/dash: +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874264 +if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ] || { [ -f "${1}" ] && ! [ -x "${1}" ]; }; then + set -- node "$@" +fi + +exec "$@"