title: How to install yarn workspace packages without symlink?
body: <p>I have a yarn workspaces project which looks something like this:</p>
  
  <pre><code>node_modules
  packages
    shared
      test.js
      package.json
    client
      test.js
      package.json
    server
      test.js
      package.json
  package.json
  server.Dockerfile
  </code></pre>
  
  <p>As you can see, I have a <code>server.Dockerfile</code>, which builds an image of the server that I can push up to different hosting providers such as Heroku or AWS.</p>
  
  <p>I copy <code>packages</code> and <code>package.json</code> into this container:</p>
  
  <pre><code>COPY packages packages
  COPY package.json .
  </code></pre>
  
  <p>And I then install only the dependencies for the <code>server</code> package:</p>
  
  <pre><code>RUN cd packages/server &amp;&amp; yarn install
  </code></pre>
  
  <p>All the dependencies are now in the <code>node_modules</code> folder, and the next thing I think of doing is to delete the <code>packages</code> folder to remove any unnecessary code from the docker image (e.g. the client code):</p>
  
  <pre><code>RUN rm -rf packages
  </code></pre>
  
  <p>The problem with this is that all the yarn workspace packages inside the <code>node_modules</code> folder are simply symlinks to the <code>packages</code> folder... so I cannot delete that folder.</p>
  
  <ul>
  <li><p>How do I get <code>yarn install</code> to make a copy of the yarn workspace packages instead of creating symlinks?</p></li>
  <li><p>Or, is there another way to remove all of the unused code (e.g. the client code) so that my docker image isn't bloated?</p></li>
  </ul>