Here is an attempt at working around adding .git into dockers accidentally, an issue you saw earlier.
Docker is written in go and supports some wildcards in the ADD command. https://stackoverflow.com/questions/26591862/using-docker-add-command-for-multiples-files links to: https://golang.org/src/path/filepath/match_test.go
Putting that together,
nfultz@nfultz:dockertest$tree -a
.
├── 1
├── 2
├── .5
├── a
│ └── 3
├── b
│ └── 4
└── Dockerfile
2 directories, 6 files
nfultz@nfultz:dockertest$cat Dockerfile
FROM ubuntu:latest
ADD [^.]* /root/
nfultz@nfultz:dockertest$docker build -t test:wildcard .
Sending build context to Docker daemon 5.632kB
Step 1/2 : FROM ubuntu:latest
---> 7b9b13f7b9c0
Step 2/2 : ADD [^.]* /root/
---> Using cache
---> b5ef390c2c49
Successfully built b5ef390c2c49
Successfully tagged test:wildcard
nfultz@nfultz:dockertest$docker run -it test:wildcard /bin/bash
root@b0f879353d4c:/# ls -latr /root/
total 20
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
-rw-r--r-- 1 root root 3106 Oct 22 2015 .bashrc
-rw-rw-r-- 1 root root 0 Jun 19 20:28 1
-rw-rw-r-- 1 root root 0 Jun 19 20:28 2
-rw-rw-r-- 1 root root 0 Jun 19 20:28 3
-rw-rw-r-- 1 root root 0 Jun 19 20:28 4
-rw-rw-r-- 1 root root 39 Jun 19 20:34 Dockerfile
drwx------ 2 root root 4096 Jun 19 20:34 .
drwxr-xr-x 35 root root 4096 Jun 19 20:34 ..
Above, you can see that infact .5
was not added into the docker.
Strangely, the extra folders were stripped out. Trying to make a v2.