title: Docker with yarn
body: <p>First time trying to get yarn and docker working together.
  How can I stop yarn from installing the packages every single time I run <code>docker build</code> command?</p>
  
  <p>I've found some solutions like storing <code>node_modules</code> in a temporary directory and then linking it, but with various packages installed I get too many errors to handle. Is there maybe a way to compare my <code>yarn.lock</code> with the one existing inside Docker or any other solutions?</p>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM node:8.9.1-alpine
  
  COPY package.json yarn.lock /usr/src/
  RUN cd /usr/src \
      &amp;&amp; yarn install --pure-lockfile
  
  COPY . /usr/src
  EXPOSE 3005
  </code></pre>
  
  <p>With this setup I get a message saying <code>Sending build context to Docker daemon  375.2MB</code>, then the <code>yarn install</code> is run as usual, fetching the packages every single time.</p>