File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ FROM node:0.0.0
3
3
RUN mkdir -p /usr/src/app
4
4
WORKDIR /usr/src/app
5
5
6
+ ONBUILD ARG NODE_ENV
6
7
ONBUILD COPY package.json /usr/src/app/
7
8
ONBUILD RUN npm install
8
9
ONBUILD COPY . /usr/src/app
Original file line number Diff line number Diff line change @@ -150,6 +150,10 @@ This `onbuild` variant will only install npm packages according to the
150
150
discussion in
151
151
[ ` nodejs/docker-node#65 ` ] ( https://github.com/nodejs/docker-node/issues/65 ) .
152
152
153
+ Note that npm installs devDependencies by default, which is undesirable if
154
+ you're building a production image. To avoid this pass NODE_ENV as a build
155
+ argument i.e. ` docker build --build-arg NODE_ENV=production … ` .
156
+
153
157
## ` node:slim `
154
158
155
159
This image does not contain the common packages contained in the default tag and
You can’t perform that action at this time.
0 commit comments