Jes*_*pez 35 node.js docker deprecation-warning dockerfile
我曾经使用 Dockerfile 中的以下内容在基于 Debian 的容器上安装 Nodejs:
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl git nano
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install nodejs -y
Run Code Online (Sandbox Code Playgroud)
但我最近开始收到以下消息:
RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl git nano
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install nodejs -y
Run Code Online (Sandbox Code Playgroud)
我如何解决它?
Mat*_*att 47
脚本的通知是
This script, located at https://deb.nodesource.com/setup_X, used to
install Node.js is deprecated now and will eventually be made inactive.
Please visit the NodeSource distributions Github and follow the
instructions to migrate your repo.
https://github.com/nodesource/distributions
The NodeSource Node.js Linux distributions GitHub repository contains
information about which versions of Node.js and which Linux distributions
are supported and how to install it.
https://github.com/nodesource/distributions
Run Code Online (Sandbox Code Playgroud)
github上的指令相当于一个DockerfileRUN
FROM docker.io/debian:12-slim
RUN set -uex; \
apt-get update; \
apt-get install -y ca-certificates curl gnupg; \
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \
| gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
NODE_MAJOR=18; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \
> /etc/apt/sources.list.d/nodesource.list; \
apt-get -qy update; \
apt-get -qy install nodejs;
Run Code Online (Sandbox Code Playgroud)
docker.io/node:18如果您想节省一些时间,Node.js 项目维护的镜像是基于 Debian 的。
FROM docker.io/node:18-bookworm-slim
Run Code Online (Sandbox Code Playgroud)
Ema*_*oli 12
根据nodesource/distributions GitHub存储库
安装脚本:安装脚本 setup_XX.x 不再受支持,也不再需要,因为任何 RPM 和 DEB 发行版的安装过程都很简单。
因此,要安装node.js,您可以使用此处解释的新方法
Node.js 安装说明
If you're root, you could just ommit the sudo下载并导入 Nodesource GPG 密钥
Run Code Online (Sandbox Code Playgroud)sudo apt-get update sudo apt-get install -y ca-certificates curl gnupg sudo mkdir -p /etc/apt/keyrings curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg创建 deb 存储库
Run Code Online (Sandbox Code Playgroud)NODE_MAJOR=20 echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
Optional: NODE_MAJOR can be changed depending on the version you need.Run Code Online (Sandbox Code Playgroud)NODE_MAJOR=16 NODE_MAJOR=18 NODE_MAJOR=20运行更新并安装
Run Code Online (Sandbox Code Playgroud)sudo apt-get update sudo apt-get install nodejs -y
或者你可以使用官方的docker镜像https://hub.docker.com/_/node/
| 归档时间: |
|
| 查看次数: |
18709 次 |
| 最近记录: |