Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker COPY with file globbing

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

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

Considering I have the following structure:

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

The destination should look like this:

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

but apparently, this doesn't work and I really don't want to specify all of the COPY operations separately if I have a chance. Any idea how to do this?

Note that I cannot basically ignore other files through .dockerignore as suggested as I am going to copy the other files from the same folder after ruining a package install operation. So, the dockerfile is similar to 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"]
like image 817
tugberk Avatar asked Feb 27 '16 14:02

tugberk


1 Answers

Workaround

Dockerfile:

COPY src/ /app/

.dockerignore:

**
!**/project.json
like image 89
Alexander Zeitler Avatar answered Sep 30 '22 13:09

Alexander Zeitler