使用nodeJS创buildUbuntu的Docker镜像4

我需要用nodeJS 4创build一个ubuntu docker镜像。我正在做的是这样的:

FROM ubuntu:16.04 RUN apt-get update -y && \ apt-get install -yqq python build-essential apt-transport-https ca-certificates curl locales nodejs npm sudo git RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10 

但是这样做有意义吗? 安装apt-get install nodejs npmcurl -sL https://deb.nodesource.com/setup_4.x | bash - curl -sL https://deb.nodesource.com/setup_4.x | bash -

另外我还要做update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10

我想让这个更小更聪明一些。

以下是我如何在Debian Jessie容器中安装nodejs:

 COPY ./rsrc/nodesource.gpg.key /tmp/nodesource.gpg.key RUN apt-key add /tmp/nodesource.gpg.key RUN echo 'deb https://deb.nodesource.com/node_6.x jessie main' > /etc/apt/sources.list.d/nodejs.list RUN apt-get update RUN apt-get install -y nodejs 

我认为在apt中join官方的回购清单是最好的select。

编辑:

前两行将encryption节点源密钥添加到apt(稍后用于encryptionvalidationpkg),然后将节点列表添加到您的易于列表,更新和安装节点包

编辑²:

另外,将专门的默认用户添加到您的节点图像。