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" ]
Alpine LinuxNode.js LTS and npm packages are available in the Main Repository. Node.js Current can be installed from the Community Repository.
RUN apk add --update nodejs npm will use the Alpine package manager to grab Node. js and npm (they're bundled separately for Alpine.)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With