Browse Source

changed node 镜像 Dockerfile

main
loong 2 years ago
parent
commit
24bf1e1bee
  1. 33
      16/Dockerfile
  2. BIN
      16/node-v16.15.1-linux-x64-musl.tar.xz

33
16/Dockerfile

@ -1,28 +1,13 @@
FROM repository.anxinyun.cn/devops/alpine:3-tz-hw FROM node:16-alpine3.15
ENV NODE_VERSION=16.15.1 RUN set -eu; \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories; \
ARG ARCH="x64" apk add --no-cache tzdata \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
ARG NODE_BINARY="node-v$NODE_VERSION-linux-$ARCH-musl" && echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata; \
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; \ npm config set registry https://registry.npm.taobao.org; \
cp /root/.npmrc /home/node/ ; \ cp /root/.npmrc /home/node; \
chown node:node /home/node/.npmrc chown node:node /home/node/.npmrc
USER node USER node
CMD [ "node" ]

BIN
16/node-v16.15.1-linux-x64-musl.tar.xz

Binary file not shown.
Loading…
Cancel
Save