title: Excluding a directory via dockerfile in nodejs app
body: <p>I have a nodejs app and I did containerized it with docker. Here is my dockerfile :</p>
  <pre><code>FROM node:14.17.0-alpine
  WORKDIR /nodejs
  COPY src/* .
  COPY app.js .
  COPY package*.json /nodejs/
  COPY . .
  RUN npm install
  
  CMD [ &quot;node&quot;, &quot;app.js&quot; ]
  </code></pre>
  <p>As you can see I am copying everything, but I want to exclude node_modules folder. What should I add to the dockerfile in order to tell to to igonore that dir?</p>
  <p><strong>UPDATE</strong>
  As mentioned in the comments, I need the .ignorefile to exclude the node_module forlder.I have already used this line :</p>
  <pre><code>**/node_modules
  </code></pre>
  <p>in .dockerignore but did not work.</p>
  <p>my folder structure :</p>
  <p><a href="https://i.stack.imgur.com/A17PA.png" rel="nofollow noreferrer">https://i.stack.imgur.com/A17PA.png</a></p>