title: Docker COPY with folder wildcards
body: <p>Given a file structure like this:</p>
  
  <pre><code>project root
  |-- X.sln
  |-- src
  |    |-- Foo
  |    |    |-- Foo.fsproj
  |    |    |-- Foo.fs
  |    |-- Bar
  |         |-- Bar.fsproj
  |         |-- Bar.fs
  |-- test
       |-- Baz
            |-- Baz.fsproj
  </code></pre>
  
  <p>I'd like to first add all <code>.fsproj</code> files to my Docker image, then run a command, then add the rest of the files. I tried the following, but <a href="https://stackoverflow.com/questions/35670907">of course it didn't work</a>:</p>
  
  <pre><code>COPY X.sln .
  COPY **/*.fsproj .
  RUN dotnet restore
  COPY . .
  RUN dotnet build
  </code></pre>
  
  <p>The idea is that after the first two <code>COPY</code> steps, the file tree on the image is like this:</p>
  
  <pre><code>working dir
  |-- X.sln
  |-- src
  |    |-- Foo
  |    |    |-- Foo.fsproj
  |    |-- Bar
  |         |-- Bar.fsproj
  |-- test
       |-- Baz
            |-- Baz.fsproj
  </code></pre>
  
  <p>and the rest of the tree is only added in <em>after</em> <code>RUN dotnet restore</code>.</p>
  
  <p>Is there a way to emulate this behavior, preferably without resorting to <a href="https://stackoverflow.com/a/35671324/38055">scripts outside of the dockerfile</a>?</p>