Browse Source

add node Dockerfile

main
loong 2 years ago
parent
commit
2ed72d0c6e
  1. 22
      16/Dockerfile
  2. 11
      16/docker-entrypoint.sh
  3. BIN
      16/node-v16.15.1-linux-x64-musl.tar.xz
  4. 15
      README.md

22
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" ]

11
16/docker-entrypoint.sh

@ -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 "$@"

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

Binary file not shown.

15
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'
最新镜像:`repository.anxinyun.cn/devops/node:16-alpine-tz`

Loading…
Cancel
Save