FROM repository.anxinyun.cn/devops/alpine:3-tz-hw ENV NODE_VERSION=16.15.1 ARG ARCH="x64" 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; \ 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; \ npm config set registry https://registry.npm.taobao.org; \ cp /root/.npmrc /home/node/ ; \ chown node:node /home/node/.npmrc USER node CMD [ "node" ]