How to install Nodejs v13.0.1 in alpine:3.8?

99封情书 提交于 2020-12-05 11:34:34

问题


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

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?


回答1:


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

Nodejs LTS:

Package nodejs

Version 12.13.0-r1

Description JavaScript runtime built on V8 engine - LTS version

Project https://nodejs.org/

nodejs-current:

Package nodejs-current

Version 13.0.1-r0

Description JavaScript runtime built on V8 engine - current stable version

Project https://nodejs.org/

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



回答2:


you can use the follwoing:

FROM alpine:3.8

RUN apk update && apk add --no-cache wget

RUN wget https://nodejs.org/dist/v13.0.1/node-v13.0.1-linux-x64.tar.xz && tar -xf node-v13.0.1-linux-x64.tar.xz

then you will has it in working directory in node-v13.0.1-linux-x64 folder



来源:https://stackoverflow.com/questions/58725215/how-to-install-nodejs-v13-0-1-in-alpine3-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!