如何在Alpine:3.8中安装Nodejs v13.0.1? [英] How to install Nodejs v13.0.1 in alpine:3.8?

查看:172
本文介绍了如何在Alpine:3.8中安装Nodejs v13.0.1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Dockerfile,以对php + nodejs应用进行dockerize。所以我从基于alpine:3.8的php:7.2.13-fpm-alpine镜像开始。
作为研究,我发现我可以通过命令添加最新的高山存储库

I am writing a Dockerfile to dockerize a php + nodejs app. so I start from php:7.2.13-fpm-alpine image which is based on alpine:3.8. As study I found that I can add latest alpine repositoriy by command

apk add  --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.10/main/ nodejs

但是,通过此命令,我只得到了nodejs v10.16.3,而我想要一个最新的(v13.0.1)
是否可以实现?

However, with this command, I only got nodejs v10.16.3 while I want a latest one(v13.0.1) Is it possible to achieve it?

推荐答案

Alpine nodejs有两个用于一个LTS的存储库,一个用于当前版本的存储库。

Alpine nodejs has two repositories for one LTS and one for the current version.

Nodejs LTS:


打包nodejs

Package nodejs

版本12.13.0-r1

Version 12.13.0-r1

基于V8引擎的JavaScript运行时描述- LTS版本

Description JavaScript runtime built on V8 engine - LTS version

项目 https://nodejs.org/

nodejs-current:


打包nodejs-current

Package nodejs-current

版本13.0.1-r0

Version 13.0.1-r0

基于V8引擎的描述JavaScript运行时-当前稳定的
版本

Description JavaScript runtime built on V8 engine - current stable version

项目 https://nodejs.org/

如果您需要当前版本,则可以使用nodejs-current

If you need current version then you have use nodejs-current

FROM  alpine:3.8
ENV ALPINE_MIRROR "http://dl-cdn.alpinelinux.org/alpine"
RUN echo "${ALPINE_MIRROR}/edge/main" >> /etc/apk/repositories
RUN apk add --no-cache nodejs-current  --repository="http://dl-cdn.alpinelinux.org/alpine/edge/community"
RUN node --version

这篇关于如何在Alpine:3.8中安装Nodejs v13.0.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆