Docker-node: set up .netcore and node.js npm in same container

Created on 18 Dec 2017  路  7Comments  路  Source: nodejs/docker-node

FROM microsoft/dotnet:2.0-runtime-deps

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

Install .NET Core

ENV DOTNET_VERSION 2.0.4
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-linux-x64.tar.gz
ENV DOTNET_DOWNLOAD_SHA 447D9F20F97133E344BDC331C2E89D9B0D05818F9AD62A72BA021343D77DF4CDDAD15F328F79797A67C9CA205A9F1FED1E6A3F156579467454AAC24C7CF260B2

RUN curl -SL $DOTNET_DOWNLOAD_URL --output dotnet.tar.gz \
&& echo "$DOTNET_DOWNLOAD_SHA dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

ENV NODE_VERSION 6.10.3

RUN set -ex \
&& for key in \
9554F04D7259F04124DE6B476D5A82AC7E37093B \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" ; \
done

set up node

RUN buildDeps='xz-utils' \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" \
&& curl -SLO "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-x64.tar.xz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-x64.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \
&& apt-get purge -y --auto-remove $buildDeps \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs

this file is suitable to set up my node to work both Dotnetcore and node.js npm.... can u check and let me know sir please....

@mikeal @chorrell @mcollina

question

Most helpful comment

fable.io projects require yarn and dotnet and mono and node at same time

All 7 comments

by using this file i can run my container... ??? npm command will work by default without mentioning in this file..??

Im curious why you would want those two on the same container instead of different one that communicate with each other?

Well npm comes with node in the node container.

I would recommend __not__ to do this. Why do you need both? Just spin up two services on two different containers and link them.

I would recommend using one of the stock image and following section of the documentation: https://github.com/nodejs/docker-node/blob/master/README.md#best-practices

fable.io projects require yarn and dotnet and mono and node at same time

Closing as "answered" :)

Was this page helpful?
0 / 5 - 0 ratings