diff --git a/16/Dockerfile b/16/Dockerfile index ad6101c..7682f7f 100644 --- a/16/Dockerfile +++ b/16/Dockerfile @@ -1,22 +1,28 @@ FROM repository.anxinyun.cn/devops/alpine:3-tz-hw -ENV NODE_VERSION 16.14.2-r0 +ENV NODE_VERSION=16.15.1 -COPY docker-entrypoint.sh /usr/local/bin/ +ARG ARCH="x64" -RUN chmod +x /usr/local/bin/docker-entrypoint.sh; \ - addgroup -g 1000 node; \ +ARG NODE_BINARY="node-v$NODE_VERSION-linux-$ARCH-musl" + +COPY "${NODE_BINARY}.tar.xz" /tmp + +RUN addgroup -g 1000 node; \ adduser -u 1000 -G node -s /bin/sh -D node; \ - apk add --no-cache nodejs==${NODE_VERSION} npm yarn; \ + set -eu; \ + apk add --no-cache libstdc++ ; \ + # 网络问题不能直接下载,手动下载 + # wget "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/${NODE_BINARY}.tar.xz" -P /tmp ; \ + tar -xJf "/tmp/${NODE_BINARY}.tar.xz" -C /usr/local --strip-components=1 --no-same-owner ; \ + ln -s /usr/local/bin/node /usr/local/bin/nodejs; \ + rm -f "/tmp/${NODE_BINARY}.tar.xz"; \ node --version; \ npm --version; \ - yarn --version; \ npm config set registry https://registry.npm.taobao.org; \ cp /root/.npmrc /home/node/ ; \ chown node:node /home/node/.npmrc USER node -ENTRYPOINT ["docker-entrypoint.sh"] - CMD [ "node" ] \ No newline at end of file diff --git a/16/docker-entrypoint.sh b/16/docker-entrypoint.sh deleted file mode 100644 index 1b3116e..0000000 --- a/16/docker-entrypoint.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/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 "$@" diff --git a/16/node-v16.15.1-linux-x64-musl.tar.xz b/16/node-v16.15.1-linux-x64-musl.tar.xz new file mode 100644 index 0000000..94b8fc2 Binary files /dev/null and b/16/node-v16.15.1-linux-x64-musl.tar.xz differ diff --git a/README.md b/README.md index e05bcf0..8a142d6 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ # Nodejs +## [dev](dev/Dockerfile) + +> +> - 内置 nvm , 默认用户 nvm +> +> - 内置 node 16 、14 、12 三个版本,使用 nvm 切换版本 +> +> + +最新镜像:`literarydragon/node:tagname:dev` + + ## [16](16/Dockerfile) > > - 使用自定义的alpine:3.15 > > - npm 仓库地址改为淘宝 > -最新镜像:`repository.anxinyun.cn/devops/node:16-alpine-tz` -node12:'repository.anxinyun.cn/devops/node:12-dev' \ No newline at end of file +最新镜像:`repository.anxinyun.cn/devops/node:16-alpine-tz`