Skip to content

Commit 3502ce7

Browse files
authored
Merge pull request #228 from mrw34/patch-1
Add NODE_ENV ARG to onbuild template
2 parents 75ef1e4 + e71d35f commit 3502ce7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Dockerfile-onbuild.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM node:0.0.0
33
RUN mkdir -p /usr/src/app
44
WORKDIR /usr/src/app
55

6+
ONBUILD ARG NODE_ENV
67
ONBUILD COPY package.json /usr/src/app/
78
ONBUILD RUN npm install
89
ONBUILD COPY . /usr/src/app

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ This `onbuild` variant will only install npm packages according to the
150150
discussion in
151151
[`nodejs/docker-node#65`](https://github.com/nodejs/docker-node/issues/65).
152152

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+
153157
## `node:slim`
154158

155159
This image does not contain the common packages contained in the default tag and

0 commit comments

Comments
 (0)