Skip to content

Commit 264307d

Browse files
tpreusseryanmurakami
authored andcommitted
Docker: Add .dockerignore file in guide (#1022)
* Add simple .dockerignore file for node Without it `COPY . /usr/src/app` will possibly overwrite node_modules inside the image * Expand .dockerignore explanation
1 parent 656ba92 commit 264307d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

locale/en/docs/guides/nodejs-docker-webapp.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ EXPOSE 8080
145145
CMD [ "npm", "start" ]
146146
```
147147

148+
## .dockerignore file
149+
150+
Create a `.dockerignore` file in the same directory as your `Dockerfile`
151+
with following content:
152+
153+
```
154+
node_modules
155+
npm-debug.log
156+
```
157+
158+
This will prevent your local modules and debug logs from being copied onto your
159+
Docker image and possibly overwriting modules installed within your image.
160+
148161
## Building your image
149162

150163
Go to the directory that has your `Dockerfile` and run the following command to

0 commit comments

Comments
 (0)