Signed-off-by: Hans Kristian Flaatten <hans@starefossen.com>
| ... | ... |
@@ -85,17 +85,18 @@ via-package-manager#rhelcentosscientific-linux-6): |
| 85 | 85 |
# Install Node.js and npm |
| 86 | 86 |
RUN yum install -y nodejs npm |
| 87 | 87 |
|
| 88 |
+Install your app dependencies using the `npm` binary: |
|
| 89 |
+ |
|
| 90 |
+ # Install app dependencies |
|
| 91 |
+ COPY package.json /src/package.json |
|
| 92 |
+ RUN cd /src; npm install |
|
| 93 |
+ |
|
| 88 | 94 |
To bundle your app's source code inside the Docker image, use the `COPY` |
| 89 | 95 |
instruction: |
| 90 | 96 |
|
| 91 | 97 |
# Bundle app source |
| 92 | 98 |
COPY . /src |
| 93 | 99 |
|
| 94 |
-Install your app dependencies using the `npm` binary: |
|
| 95 |
- |
|
| 96 |
- # Install app dependencies |
|
| 97 |
- RUN cd /src; npm install |
|
| 98 |
- |
|
| 99 | 100 |
Your app binds to port `8080` so you'll use the `EXPOSE` instruction to have |
| 100 | 101 |
it mapped by the `docker` daemon: |
| 101 | 102 |
|
| ... | ... |
@@ -116,11 +117,13 @@ Your `Dockerfile` should now look like this: |
| 116 | 116 |
# Install Node.js and npm |
| 117 | 117 |
RUN yum install -y nodejs npm |
| 118 | 118 |
|
| 119 |
- # Bundle app source |
|
| 120 |
- COPY . /src |
|
| 121 | 119 |
# Install app dependencies |
| 120 |
+ COPY package.json /src/package.json |
|
| 122 | 121 |
RUN cd /src; npm install |
| 123 | 122 |
|
| 123 |
+ # Bundle app source |
|
| 124 |
+ COPY . /src |
|
| 125 |
+ |
|
| 124 | 126 |
EXPOSE 8080 |
| 125 | 127 |
CMD ["node", "/src/index.js"] |
| 126 | 128 |
|