Piggy bank dockers with file extension

Inside the docker file, I want to specify a copy operation for files that are defined using globbing, and I want it to be copied with this path as well. So something like this:

COPY ./src/**/project.json /app/**/

Given that I have the following structure:

./src/bar/project.json
./src/foo/project.json

The assignment should look like this:

/app/bar/project.json
/app/foo/project.json

but apparently this does not work, and I really do not want to specify all COPY operations separately if I have a chance. Any idea how to do this?

Please note that I can’t basically ignore other files through .dockerignore as suggested , since I am going to copy other files from the same folder after breaking the package installation operation. So, the docker file looks like this:

FROM microsoft/aspnet:1.0.0-rc1-update1

COPY ./src/**/project.json /app/**/
WORKDIR /app/ModernShopping.Auth
RUN ["dnu", "restore"]
ADD ./src /app

EXPOSE 44300
ENTRYPOINT ["dnx", "web"]
+4
2

docker build script ( "build" ).

  • tmp ( Dockerfile, docker build)
  • cp : cp ./src/**/project.json tmp
  • docker build, Dockerfile COPY tmp/ /app/
  • tmp.

, , , .

+3

Dockerfile:

COPY src/ /app/

.dockerignore:

**
!**/project.json
+1

All Articles