repo2docker icon indicating copy to clipboard operation
repo2docker copied to clipboard

Support ignoring paths from a repo by reading a .dockerignore file

Open SylvainCorlay opened this issue 5 years ago • 4 comments
trafficstars

Is there a means to exclude files of the git repository from the docker image?

The use case is that of a (private) repository including solution notebooks to an assignment.

I presume this could be achieved with a post-build or so, but simply asking if we could have a configuration thing to include e.g. directories from the build (as well as the .git folder I guess).

SylvainCorlay avatar Aug 04 '20 11:08 SylvainCorlay

You can add .dockerignore file into the root of your repo. This file is used by docker for the same purpose as .gitignore file by git.

dolfinus avatar May 18 '21 12:05 dolfinus

@dolfinus I don't think repo2docker respects .dockerignore files.

yuvipanda avatar Jan 05 '22 16:01 yuvipanda

That's unfortunate. Without respecting .dockerignore repo2docker adds all the files from the repo folder into the docker image, including .git folder. This is messing up with the docker layer caching mechanism and also increasing the resulting image on every pushed commit

dolfinus avatar Mar 06 '22 18:03 dolfinus

Yeah, I think adding .dockerignore support would be a good addition to repo2docker functionality. I'll retitle the issue.

yuvipanda avatar Mar 06 '22 18:03 yuvipanda