diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..bcfcd4e --- /dev/null +++ b/.npmrc @@ -0,0 +1,15 @@ +registry=https://registry.npmmirror.com +disturl=https://registry.npmmirror.com/-/binary/node/ +# node-sass预编译二进制文件下载地址 +sass_binary_site=https://registry.npmmirror.com/-/binary/node-sass +# sharp预编译共享库, 截止2022-09-20 sharp@0.31.0的预编译共享库并未同步到镜像, 入安装失败可切换到sharp@0.30.7使用 +sharp_libvips_binary_host=https://registry.npmmirror.com/-/binary/sharp-libvips +python_mirror=https://registry.npmmirror.com/-/binary/python/ +electron_mirror=https://registry.npmmirror.com/-/binary/electron/ +electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/ +# 无特殊配置参考{pkg-name}_binary_host_mirror={mirror} +canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas +node_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/sqlite3 +better_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3 +# phantomjs +phantomjs-cdnurl=https://repo.huaweicloud.com/phantomjs/ \ No newline at end of file diff --git a/10/Dockerfile b/10/Dockerfile index b7e873f..fca2244 100644 --- a/10/Dockerfile +++ b/10/Dockerfile @@ -2,6 +2,9 @@ FROM node:10-buster-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/buster.http /etc/apt/sources.list RUN apt-get update \ @@ -9,15 +12,13 @@ RUN apt-get update \ # 添加软件密钥,因为该版本的node官方已经drop了,后续没有基于新的debian底包更新,所以会有key缺失的情况导致apt-get update失败 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 6ED0E7B82643E131 COPY --chown=root:root apt/buster /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info +RUN npm version >> .node-cn-info ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file diff --git a/12/Dockerfile b/12/Dockerfile index dab87db..2740de0 100644 --- a/12/Dockerfile +++ b/12/Dockerfile @@ -2,20 +2,21 @@ FROM node:12-bullseye-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/bullseye.http /etc/apt/sources.list RUN apt-get update && apt-get install -y apt-transport-https ca-certificates COPY --chown=root:root apt/bullseye /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm i -g pnpm@6 \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info +RUN npm i -g pnpm@6 \ + && npm version >> .node-cn-info ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file diff --git a/14/Dockerfile b/14/Dockerfile index ede4e40..628a7ff 100644 --- a/14/Dockerfile +++ b/14/Dockerfile @@ -2,20 +2,21 @@ FROM node:14-bullseye-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/bullseye.http /etc/apt/sources.list RUN apt-get update && apt-get install -y apt-transport-https ca-certificates COPY --chown=root:root apt/bullseye /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm i -g pnpm@7 \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info +RUN npm i -g pnpm@7 \ + && npm version >> .node-cn-info ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file diff --git a/16/Dockerfile b/16/Dockerfile index 2d50357..fda5164 100644 --- a/16/Dockerfile +++ b/16/Dockerfile @@ -2,20 +2,21 @@ FROM node:16-bookworm-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/bookworm.http /etc/apt/sources.list RUN apt-get update && apt-get install -y apt-transport-https ca-certificates COPY --chown=root:root apt/bookworm /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm i -g pnpm \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info +RUN npm i -g pnpm \ + && npm version >> .node-cn-info ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file diff --git a/18/Dockerfile b/18/Dockerfile index 704efaa..8a62798 100644 --- a/18/Dockerfile +++ b/18/Dockerfile @@ -2,20 +2,21 @@ FROM node:18-bookworm-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/bookworm.http /etc/apt/sources.list RUN apt-get update && apt-get install -y apt-transport-https ca-certificates COPY --chown=root:root apt/bookworm /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm i -g pnpm \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info +RUN npm i -g pnpm \ + && npm version >> .node-cn-info ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file diff --git a/20/Dockerfile b/20/Dockerfile index 7f2291e..9790c22 100644 --- a/20/Dockerfile +++ b/20/Dockerfile @@ -2,20 +2,21 @@ FROM node:20-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/bookworm.http /etc/apt/sources.list RUN apt-get update && apt-get install -y apt-transport-https ca-certificates COPY --chown=root:root apt/bookworm /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm i -g pnpm \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info - +RUN npm i -g pnpm \ + && npm version >> .node-cn-info + ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file diff --git a/8/Dockerfile b/8/Dockerfile index e698f20..6cc7786 100644 --- a/8/Dockerfile +++ b/8/Dockerfile @@ -2,6 +2,9 @@ FROM node:8-buster-slim LABEL org.opencontainers.image.authors="wakefun" LABEL org.opencontainers.image.documentation="https://github.com/wakefun/docker-node-cn/blob/main/README.MD" +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin + USER root COPY --chown=root:root apt/buster.http /etc/apt/sources.list RUN apt-get update \ @@ -9,15 +12,14 @@ RUN apt-get update \ # 添加软件密钥,因为该版本的node官方已经drop了,后续没有基于新的debian底包更新,所以会有key缺失的情况导致apt-get update失败 && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 6ED0E7B82643E131 COPY --chown=root:root apt/buster /etc/apt/sources.list +COPY --chown=node:node .npmrc /home/node/.npmrc +RUN mkdir -p /home/node/.npm-global/etc \ + && cat /home/node/.npmrc >> {}/etc/npmrc' USER node RUN mkdir -p /home/node/node-cn WORKDIR /home/node/node-cn -ENV NPM_CONFIG_PREFIX=/home/node/.npm-global -ENV PATH=$PATH:/home/node/.npm-global/bin -RUN npm config set registry https://registry.npmmirror.com \ - && yarn config set registry=https://registry.npmmirror.com \ - && npm version >> .node-cn-info \ - && yarn versions >> .node-cn-info + +RUN npm version >> .node-cn-info ONBUILD RUN cat /home/node/node-cn/.node-cn-info \ No newline at end of file