How to install Nodejs 8.12 in alpine:3.8?












0















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" ]










share|improve this question























  • From this, it's already alpine3.8 & nodejs8.12.0

    – lagom
    Nov 20 '18 at 8:54











  • Thank you @lagom for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t my-image . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:12


















0















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" ]










share|improve this question























  • From this, it's already alpine3.8 & nodejs8.12.0

    – lagom
    Nov 20 '18 at 8:54











  • Thank you @lagom for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t my-image . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:12
















0












0








0


1






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" ]










share|improve this question














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" ]







node.js docker npm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 8:39









KarthickKarthick

133




133













  • From this, it's already alpine3.8 & nodejs8.12.0

    – lagom
    Nov 20 '18 at 8:54











  • Thank you @lagom for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t my-image . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:12





















  • From this, it's already alpine3.8 & nodejs8.12.0

    – lagom
    Nov 20 '18 at 8:54











  • Thank you @lagom for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t my-image . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:12



















From this, it's already alpine3.8 & nodejs8.12.0

– lagom
Nov 20 '18 at 8:54





From this, it's already alpine3.8 & nodejs8.12.0

– lagom
Nov 20 '18 at 8:54













Thank you @lagom for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t my-image . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

– Karthick
Nov 20 '18 at 9:12







Thank you @lagom for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t my-image . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

– Karthick
Nov 20 '18 at 9:12














1 Answer
1






active

oldest

votes


















0














Taking references from : https://github.com/nodejs/docker-node



FROM alpine:3.8

ENV NODE_VERSION 8.12.0

RUN addgroup -g 1000 node
&& adduser -u 1000 -G node -s /bin/sh -D node
&& apk add --no-cache
libstdc++
&& apk add --no-cache --virtual .build-deps
binutils-gold
curl
g++
gcc
gnupg
libgcc
linux-headers
make
python
# gpg keys listed at https://github.com/nodejs/node#release-team
&& for key in
94AE36675C464D64BAFA68DD7434390BDBE9B9C5
FD3A5288F042B6850C66B31F09FE44734EB7990E
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
DD8F2338BAE7501E3DD5AC78C273792F7D83545D
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
B9AE9905FFD7803F25714661B63B535A4C206CA9
56730D5401028683275BD23C23EFEFE93C4CFFFE
77984A986EBC2AA786BC0F66B01FBB92821C587A
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
&& grep " node-v$NODE_VERSION.tar.xz$" SHASUMS256.txt | sha256sum -c -
&& tar -xf "node-v$NODE_VERSION.tar.xz"
&& cd "node-v$NODE_VERSION"
&& ./configure
&& make -j$(getconf _NPROCESSORS_ONLN)
&& make install
&& apk del .build-deps
&& cd ..
&& rm -Rf "node-v$NODE_VERSION"
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt

ENV YARN_VERSION 1.9.4

RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar
&& for key in
6A010C5166006599AA17F08146C2130DFD2497F5
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& mkdir -p /opt
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& apk del .build-deps-yarn

CMD [ "node" ]





share|improve this answer
























  • Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:13













  • Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

    – yodebu
    Nov 20 '18 at 10:26













  • Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

    – yodebu
    Nov 20 '18 at 10:31











  • Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

    – Karthick
    Nov 20 '18 at 23:44











  • Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

    – yodebu
    Nov 22 '18 at 5:21











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389095%2fhow-to-install-nodejs-8-12-in-alpine3-8%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Taking references from : https://github.com/nodejs/docker-node



FROM alpine:3.8

ENV NODE_VERSION 8.12.0

RUN addgroup -g 1000 node
&& adduser -u 1000 -G node -s /bin/sh -D node
&& apk add --no-cache
libstdc++
&& apk add --no-cache --virtual .build-deps
binutils-gold
curl
g++
gcc
gnupg
libgcc
linux-headers
make
python
# gpg keys listed at https://github.com/nodejs/node#release-team
&& for key in
94AE36675C464D64BAFA68DD7434390BDBE9B9C5
FD3A5288F042B6850C66B31F09FE44734EB7990E
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
DD8F2338BAE7501E3DD5AC78C273792F7D83545D
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
B9AE9905FFD7803F25714661B63B535A4C206CA9
56730D5401028683275BD23C23EFEFE93C4CFFFE
77984A986EBC2AA786BC0F66B01FBB92821C587A
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
&& grep " node-v$NODE_VERSION.tar.xz$" SHASUMS256.txt | sha256sum -c -
&& tar -xf "node-v$NODE_VERSION.tar.xz"
&& cd "node-v$NODE_VERSION"
&& ./configure
&& make -j$(getconf _NPROCESSORS_ONLN)
&& make install
&& apk del .build-deps
&& cd ..
&& rm -Rf "node-v$NODE_VERSION"
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt

ENV YARN_VERSION 1.9.4

RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar
&& for key in
6A010C5166006599AA17F08146C2130DFD2497F5
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& mkdir -p /opt
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& apk del .build-deps-yarn

CMD [ "node" ]





share|improve this answer
























  • Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:13













  • Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

    – yodebu
    Nov 20 '18 at 10:26













  • Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

    – yodebu
    Nov 20 '18 at 10:31











  • Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

    – Karthick
    Nov 20 '18 at 23:44











  • Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

    – yodebu
    Nov 22 '18 at 5:21
















0














Taking references from : https://github.com/nodejs/docker-node



FROM alpine:3.8

ENV NODE_VERSION 8.12.0

RUN addgroup -g 1000 node
&& adduser -u 1000 -G node -s /bin/sh -D node
&& apk add --no-cache
libstdc++
&& apk add --no-cache --virtual .build-deps
binutils-gold
curl
g++
gcc
gnupg
libgcc
linux-headers
make
python
# gpg keys listed at https://github.com/nodejs/node#release-team
&& for key in
94AE36675C464D64BAFA68DD7434390BDBE9B9C5
FD3A5288F042B6850C66B31F09FE44734EB7990E
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
DD8F2338BAE7501E3DD5AC78C273792F7D83545D
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
B9AE9905FFD7803F25714661B63B535A4C206CA9
56730D5401028683275BD23C23EFEFE93C4CFFFE
77984A986EBC2AA786BC0F66B01FBB92821C587A
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
&& grep " node-v$NODE_VERSION.tar.xz$" SHASUMS256.txt | sha256sum -c -
&& tar -xf "node-v$NODE_VERSION.tar.xz"
&& cd "node-v$NODE_VERSION"
&& ./configure
&& make -j$(getconf _NPROCESSORS_ONLN)
&& make install
&& apk del .build-deps
&& cd ..
&& rm -Rf "node-v$NODE_VERSION"
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt

ENV YARN_VERSION 1.9.4

RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar
&& for key in
6A010C5166006599AA17F08146C2130DFD2497F5
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& mkdir -p /opt
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& apk del .build-deps-yarn

CMD [ "node" ]





share|improve this answer
























  • Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:13













  • Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

    – yodebu
    Nov 20 '18 at 10:26













  • Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

    – yodebu
    Nov 20 '18 at 10:31











  • Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

    – Karthick
    Nov 20 '18 at 23:44











  • Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

    – yodebu
    Nov 22 '18 at 5:21














0












0








0







Taking references from : https://github.com/nodejs/docker-node



FROM alpine:3.8

ENV NODE_VERSION 8.12.0

RUN addgroup -g 1000 node
&& adduser -u 1000 -G node -s /bin/sh -D node
&& apk add --no-cache
libstdc++
&& apk add --no-cache --virtual .build-deps
binutils-gold
curl
g++
gcc
gnupg
libgcc
linux-headers
make
python
# gpg keys listed at https://github.com/nodejs/node#release-team
&& for key in
94AE36675C464D64BAFA68DD7434390BDBE9B9C5
FD3A5288F042B6850C66B31F09FE44734EB7990E
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
DD8F2338BAE7501E3DD5AC78C273792F7D83545D
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
B9AE9905FFD7803F25714661B63B535A4C206CA9
56730D5401028683275BD23C23EFEFE93C4CFFFE
77984A986EBC2AA786BC0F66B01FBB92821C587A
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
&& grep " node-v$NODE_VERSION.tar.xz$" SHASUMS256.txt | sha256sum -c -
&& tar -xf "node-v$NODE_VERSION.tar.xz"
&& cd "node-v$NODE_VERSION"
&& ./configure
&& make -j$(getconf _NPROCESSORS_ONLN)
&& make install
&& apk del .build-deps
&& cd ..
&& rm -Rf "node-v$NODE_VERSION"
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt

ENV YARN_VERSION 1.9.4

RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar
&& for key in
6A010C5166006599AA17F08146C2130DFD2497F5
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& mkdir -p /opt
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& apk del .build-deps-yarn

CMD [ "node" ]





share|improve this answer













Taking references from : https://github.com/nodejs/docker-node



FROM alpine:3.8

ENV NODE_VERSION 8.12.0

RUN addgroup -g 1000 node
&& adduser -u 1000 -G node -s /bin/sh -D node
&& apk add --no-cache
libstdc++
&& apk add --no-cache --virtual .build-deps
binutils-gold
curl
g++
gcc
gnupg
libgcc
linux-headers
make
python
# gpg keys listed at https://github.com/nodejs/node#release-team
&& for key in
94AE36675C464D64BAFA68DD7434390BDBE9B9C5
FD3A5288F042B6850C66B31F09FE44734EB7990E
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1
DD8F2338BAE7501E3DD5AC78C273792F7D83545D
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8
B9AE9905FFD7803F25714661B63B535A4C206CA9
56730D5401028683275BD23C23EFEFE93C4CFFFE
77984A986EBC2AA786BC0F66B01FBB92821C587A
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz"
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc"
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc
&& grep " node-v$NODE_VERSION.tar.xz$" SHASUMS256.txt | sha256sum -c -
&& tar -xf "node-v$NODE_VERSION.tar.xz"
&& cd "node-v$NODE_VERSION"
&& ./configure
&& make -j$(getconf _NPROCESSORS_ONLN)
&& make install
&& apk del .build-deps
&& cd ..
&& rm -Rf "node-v$NODE_VERSION"
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt

ENV YARN_VERSION 1.9.4

RUN apk add --no-cache --virtual .build-deps-yarn curl gnupg tar
&& for key in
6A010C5166006599AA17F08146C2130DFD2497F5
; do
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ||
gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" ||
gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ;
done
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz"
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc"
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& mkdir -p /opt
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn
&& ln -s /opt/yarn-v$YARN_VERSION/bin/yarnpkg /usr/local/bin/yarnpkg
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz
&& apk del .build-deps-yarn

CMD [ "node" ]






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 8:48









yodebuyodebu

846




846













  • Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:13













  • Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

    – yodebu
    Nov 20 '18 at 10:26













  • Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

    – yodebu
    Nov 20 '18 at 10:31











  • Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

    – Karthick
    Nov 20 '18 at 23:44











  • Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

    – yodebu
    Nov 22 '18 at 5:21



















  • Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

    – Karthick
    Nov 20 '18 at 9:13













  • Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

    – yodebu
    Nov 20 '18 at 10:26













  • Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

    – yodebu
    Nov 20 '18 at 10:31











  • Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

    – Karthick
    Nov 20 '18 at 23:44











  • Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

    – yodebu
    Nov 22 '18 at 5:21

















Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

– Karthick
Nov 20 '18 at 9:13







Thank you @yodebu for your effort! unfortunately that doesn't give me output at all. With that link in git I am unable to build an image, if I give docker build -t tag-name . my terminal is running for a long time and com.docker.hyperkit shoots up to 250% usage. Can you please let me know how to alter my Dockerfile with the help of the above reference file? I might have used wrongly.

– Karthick
Nov 20 '18 at 9:13















Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

– yodebu
Nov 20 '18 at 10:26







Hi @Karthick, this should take some time and cpu usage should go high as, here nodejs is built from source. You should wait for the build to happen and you can use the same image or a reference image to build your Dockerfile.

– yodebu
Nov 20 '18 at 10:26















Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

– yodebu
Nov 20 '18 at 10:31





Hi @Karthick, can you provide a strace or a dump of the process running? Googling around, I see alot of Mac users facing the same issue while using docker.

– yodebu
Nov 20 '18 at 10:31













Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

– Karthick
Nov 20 '18 at 23:44





Thank you @yodebu unfortunately I can't provide you the strace because the length is so long. If you can give me your email I think I can send you out. So apart from this isn't there any other way to install nodejs8.12 in alpine 3.8, like installing through some other tools or do I have to generate apk for nodejs?

– Karthick
Nov 20 '18 at 23:44













Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

– yodebu
Nov 22 '18 at 5:21





Hi @Karthick I think node8.12 alpine image is built on top of alpine3.8 :) That should work fine.

– yodebu
Nov 22 '18 at 5:21


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389095%2fhow-to-install-nodejs-8-12-in-alpine3-8%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

A Topological Invariant for $pi_3(U(n))$