title: Run webpack build during docker-compose build process
body: <p>I am trying to build a production docker container with a minified version of the js files.</p>
  
  <p>In my <code>Dockerfile</code>, after installing the npm packages, I am trying to build the webpack compilation.</p>
  
  <pre><code>RUN npm install -g n  # upgrading the npm version
  RUN n stable
  ADD ./webpack/package.json /package.json
  RUN npm install --production
  RUN npm run build-production  # &lt;&lt;&lt; Fails here
  </code></pre>
  
  <p>The docker build process will fail during the last command <code>RUN npm run build-production</code> with npm complaining that it can't find the installed packages (<code>NODE_PATH</code> is set). </p>
  
  <p>However, when I add the call <code>npm run build-production</code> to my <code>ENTRYPOINT</code> script, it works fine and compiles everything as expected. However, it runs the webpack build everything I start the container, which isn't desired.</p>
  
  <p>Why can't the last docker build step find the packages installed in the previous steps? But why does it work through the entrypoint script?</p>
  
  <p>What is the best way to add the webpack build to the docker build in my Dockerfile?</p>