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

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

问题描述

我正在编写一个Dockerfile,以对一个示例nodejs应用进行Docker化。我在 Nodejs v8.12 npm 6.4.1 中进行了开发。我知道我可以使用 node:8.12-alpine 图片获取结果。但是我使用的是 alpine:3.8 图片,这是官方推荐的图片。



如果我使用Dockerfile来构建映像,则我的Dockerfile内容如下所示,最终将导致从高山存储库下载最新版本的nodejs。我不希望发生这种情况,因此我计划手动安装该软件包以实现可复制性。最可悲的部分是我找不到 Nodejs v8.12 npm 的apk版本。



任何人都可以帮助我在哪里找到 Nodejs v8.12 的APK或如何安装此版本将Nodejs手动添加到我的图像中? nodejs-npm
COPY。 ./
RUN npm install
EXPOSE 9001
CMD [ npm, start]

解决方案

问题已经回答,但今天我面临问题,所以这就是我如何在Alpine中使用nodejs 8构建

  FROM高山:3.8 
RUN apk添加--no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/main/ nodejs = 8.9.3 -r1

您可以在Alpine repo v3.7中找到节点8





您可以在此处找到节点版本详细信息,分支约定为v3.x


I am writing a Dockerfile to dockerize a sample nodejs app. I developed that in Nodejs v8.12 and npm 6.4.1. I know that I can use node:8.12-alpine image to get results. But I am using alpine:3.8 image which is officially recommended.

My Dockerfile contents are below if I use that to build image I will end up in downloading latest version of nodejs from alpine repo. I don't want that to happen, So I planned to install the package manually for the purpose of reproducible. The saddest part is I am unable to find apk version of Nodejs v8.12 and npm.

Can any one help me on where can I find apk for Nodejs v8.12 or how to install this version of Nodejs to my image manually?

FROM alpine:3.8 WORKDIR /app RUN apk add --update nodejs nodejs-npm COPY . ./ RUN npm install EXPOSE 9001 CMD [ "npm", "start" ]

解决方案

The question already answered but today I was facing issue so this is how i build with nodejs 8 in Alpine

FROM alpine:3.8
RUN apk add  --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.7/main/ nodejs=8.9.3-r1

You can find node 8 in Alpine repo v3.7

https://pkgs.alpinelinux.org/packages?name=nodejs&branch=v3.7

you can find node version details here, branch convention is v3.x

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

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