gpt4 book ai didi

node.js - Dockerfile ubuntu只安装node 4.2版本

转载 作者:搜寻专家 更新时间:2023-11-01 00:36:38 24 4
gpt4 key购买 nike

这个 dockerfile 安装了 nodejs 4.2 版本,我不明白为什么。有人可以帮我安装 node 9.2 吗?我试过取出 --no install-recommends 命令无济于事。

向她添加更多文本,因为堆栈不允许我发布此问题,即使这是一个非常简单的问题,我已经在网上查看了很长时间但无济于事。向她添加更多文本,因为堆栈不允许我发布发布这个问题,尽管这是一个非常简单的问题,我已经在网上查看了很长时间但无济于事。

   FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends curl sudo
RUN curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
RUN apt-get install -y nodejs && \
apt-get install --yes build-essential
RUN apt-get install --yes npm

#VOLUME "/usr/local/app"

# Set up C++ dev env
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install gcc-multilib g++-multilib cmake wget -y && \
apt-get clean autoclean && \
apt-get autoremove -y
#wget -O /tmp/conan.deb -L https://github.com/conan-io/conan/releases/download/0.25.1/conan-ubuntu-64_0_25_1.deb && \
#dpkg -i /tmp/conan.deb

#ADD ./scripts/cmake-build.sh /build.sh
#RUN chmod +x /build.sh
#RUN /build.sh


RUN mkdir -p /usr/local/app
WORKDIR /usr/local/app
COPY package.json /usr/local/app
RUN ["npm", "install"]
COPY . .


RUN echo "/usr/local/app/dm" > /etc/ld.so.conf.d/mythrift.conf
RUN echo "/usr/lib/x86_64-linux-gnu" >> /etc/ld.so.conf.d/mythrift.conf
RUN echo "/usr/local/lib64" >> /etc/ld.so.conf.d/mythrift.conf
RUN ldconfig

RUN chmod +x dm/dm3
RUN ldd dm/dm3
RUN ["chmod", "+x", "dm/dm3"]
RUN ["chmod", "777", "policy"]
RUN ls -al .
RUN ["nodejs", "-v"]
CMD ["nodejs", "-v"]

最佳答案

编辑

显然,OP 运行这个版本的 ubuntu 很重要。这是一个构建在 FROM ubuntu:16.04 之上的示例:

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --reinstall ca-certificates curl build-essential \
&& curl -s https://nodejs.org/dist/v9.9.0/node-v9.9.0-linux-x64.tar.xz \
-o node-v9.9.0-linux-x64.tar.xz && tar xf node-v9.9.0-linux-x64.tar.xz \
&& cd node-v9.9.0-linux-x64 && cp -r bin include lib share /usr/local \
&& rm -rf /node-v9.9.0-linux-x64.tar.xz /node-v9.9.0-linux-x64

CMD ["node", "-v"]

构建

docker build -t testing .

测试

docker run testing
v9.9.0

请注意,这只会处理与 Node 相关的事情,不会考虑所有其他依赖项。

关于node.js - Dockerfile ubuntu只安装node 4.2版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49329976/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com