title: Docker multi-stage build not copying between stages
body: <p>I'm trying to create a multi-stage build where the first stage does a yarn install for the theme and the second stage sets up the PHP environment for Drupal.</p>
  
  <p>When I look at the output it looks like yarn install is being run but the <code>COPY</code> command near the bottom doesn't copy it across to the PHP image. If I'm right when this works the node_modules directory should be created on my local machine?</p>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>version: '3.7'
  services:
    web:
      build:
        context: .
        dockerfile: Dockerfile
      volumes:
        - ./:/var/www/html:cached
      env_file:
        - ./local-development.env
      ports:
        - "8888:80"
    db:
      image: mysql:5.7
      env_file:
        - ./local-development.env
      ports:
        - "3306:3306"
  </code></pre>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM node:latest as yarn-install
  WORKDIR /app
  COPY ./web/themes/material_admin_mine ./
  RUN yarn install --verbose --force;
  
  # from https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements
  FROM php:7.2-apache
  
  # Install &amp; setup Xdebug
  RUN yes | pecl install xdebug \
  &amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo "xdebug.remote_enable=1" &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.remote_connect_back=0' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.remote_host=docker.for.mac.localhost' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.remote_port=9000' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.remote_handler=dbgp' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.remote_mode=req' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.remote_autostart=1' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini \
  &amp;&amp; echo 'xdebug.idekey=PHPSTORM' &gt;&gt; /usr/local/etc/php/conf.d/xdebug.ini
  
  # Install git &amp; mysql-client for running Drush
  RUN apt update; \
  apt install -y \
  git \
  mysql-client
  
  # install the PHP extensions we need
  RUN set -ex; \
  \
  if command -v a2enmod; then \
      a2enmod rewrite; \
  fi; \
  \
  savedAptMark="$(apt-mark showmanual)"; \
  \
  apt-get update; \
  apt-get install -y --no-install-recommends \
      libjpeg-dev \
      libpng-dev \
      libpq-dev \
      unzip \
      git \
  ; \
  \
  curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer; \
  \
  docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \
  docker-php-ext-install -j "$(nproc)" \
      gd \
      opcache \
      pdo_mysql \
      pdo_pgsql \
      zip \
  ; \
  \
  # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
  apt-mark auto '.*' &gt; /dev/null; \
  apt-mark manual $savedAptMark; \
  ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
      | awk '/=&gt;/ { print $3 }' \
      | sort -u \
      | xargs -r dpkg-query -S \
      | cut -d: -f1 \
      | sort -u \
      | xargs -rt apt-mark manual; \
  \
  apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
  rm -rf /var/lib/apt/lists/*
  
  # set recommended PHP.ini settings
  # see https://secure.php.net/manual/en/opcache.installation.php
  RUN { \
      echo 'opcache.memory_consumption=128'; \
      echo 'opcache.interned_strings_buffer=8'; \
      echo 'opcache.max_accelerated_files=4000'; \
      echo 'opcache.revalidate_freq=60'; \
      echo 'opcache.fast_shutdown=1'; \
      echo 'opcache.enable_cli=1'; \
  } &gt; /usr/local/etc/php/conf.d/opcache-recommended.ini
  
  # Various packages required to run Gulp in the theme directory
  # gnupg is require for nodejs
  RUN apt update; \
  apt install gnupg -y; \
  apt install gnupg1 -y; \
  apt install gnupg2 -y; \
  cd ~; \
  curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh; \
  bash nodesource_setup.sh; \
  apt install nodejs -y; \
  npm install gulp-cli -g -y; \
  curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - ;\
  echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \
  apt update &amp;&amp; apt install yarn -y;
  
  WORKDIR /var/www/html
  COPY --from=0 /app ./web/themes/material_admin_mine
  </code></pre>