From 641c739fc1352aab8937ea8f0280082fa8e67ff8 Mon Sep 17 00:00:00 2001 From: Hans Kristian Flaatten Date: Sun, 8 Nov 2015 14:11:48 +0100 Subject: [PATCH] Utillize build cache for Node.js web app example Signed-off-by: Hans Kristian Flaatten --- docs/examples/nodejs_web_app.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/examples/nodejs_web_app.md b/docs/examples/nodejs_web_app.md index a1aa004189..158432a217 100644 --- a/docs/examples/nodejs_web_app.md +++ b/docs/examples/nodejs_web_app.md @@ -85,17 +85,18 @@ via-package-manager#rhelcentosscientific-linux-6): # Install Node.js and npm RUN yum install -y nodejs npm +Install your app dependencies using the `npm` binary: + + # Install app dependencies + COPY package.json /src/package.json + RUN cd /src; npm install + To bundle your app's source code inside the Docker image, use the `COPY` instruction: # Bundle app source COPY . /src -Install your app dependencies using the `npm` binary: - - # Install app dependencies - RUN cd /src; npm install - Your app binds to port `8080` so you'll use the `EXPOSE` instruction to have it mapped by the `docker` daemon: @@ -116,10 +117,12 @@ Your `Dockerfile` should now look like this: # Install Node.js and npm RUN yum install -y nodejs npm + # Install app dependencies + COPY package.json /src/package.json + RUN cd /src; npm install + # Bundle app source COPY . /src - # Install app dependencies - RUN cd /src; npm install EXPOSE 8080 CMD ["node", "/src/index.js"]