You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
898 B

2 years ago
FROM repository.anxinyun.cn/devops/alpine:3-tz-hw
ENV NODE_VERSION=16.15.1
2 years ago
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
2 years ago
USER node
CMD [ "node" ]