I have a .dockerignore file in which I want to exclude the entire directory /src except all .json files in that /src-Directory.
My current approach looks like this:
/src/*
!/src/**/*.json
I have also tried using /src instead of /src/*, but in both cases is the entire directory excluded and the JSON files are nowhere to be found.
You should change the ignore file as follow:
The reason is that
!/src/**/*.jsonsearches for json files inside subfolder of/src, and not in/srcitself too.Look at the official documentation if you need further info https://docs.docker.com/engine/reference/builder/#dockerignore-file .