gpt4 book ai didi

node.js - 使用 Dockerfile 在 ubuntu 镜像中安装特定版本的 node.js 和 npm

转载 作者:太空宇宙 更新时间:2023-11-03 17:10:28 25 4
gpt4 key购买 nike

我想知道如何更新我的自定义 Dockerfile 以安装 Node v6.3.1 和 NPM v3.10.6 而不会破坏其中已有的内容。

目前这是我的自定义文件:

FROM         ubuntu:16.10

MAINTAINER Fátima Alves

COPY . /my-software
WORKDIR /my-software

RUN apt-get update \
&& \
apt-get install -y \
python-dev \
tesseract-ocr

谢谢!


更新

目前我的dockerfile是这样的:

FROM         ubuntu:16.10

MAINTAINER Fátima Alves

COPY ./dist /my-software
COPY ./s3-config.json /my-software
COPY ./_* /my-software
COPY ./node_modules /my-software
WORKDIR /dataextractor

RUN apt-get update \
&& \
apt-get install -y \
curl

RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get install -y nodejs

返回:

The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_6.x | bash -             && apt-get install -y nodejs' returned a non-zero code: 1

也许我遗漏了什么?

最佳答案

您可以按照通常的 Ubuntu 安装说明进行操作,只需在 Dockerfile

中的 RUN 语句中
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - \
&& apt-get install -y nodejs

Docs

关于node.js - 使用 Dockerfile 在 ubuntu 镜像中安装特定版本的 node.js 和 npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39081726/

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