Add .dockerignore file to repo
The .dockerignore file is like .gitignore, what declared in it won't find it's way into the container(or docker daemon) via ADD/COPY commands, thus reducing image size & build time.
https://docs.docker.com/engine/reference/builder/#dockerignore-file
currently all files in git repo are added to the container.
podman run --rm -ti --entrypoint /bin/bash registry.salsa.debian.org/reproducible-builds/diffoscope
root@0f96aae3b49a:/# ls -laF /srv/diffoscope/
total 124
drwxr-xr-x. 8 root root 4096 Apr 11 18:15 ./
drwxr-xr-x. 3 root root 4096 Apr 11 18:15 ../
-rw-r--r--. 1 root root 60 Apr 11 18:10 .coveragerc
drwxr-xr-x. 8 root root 4096 Apr 11 18:12 .git/
-rw-r--r--. 1 root root 82 Apr 11 18:10 .git-blame-ignore-revs
-rw-r--r--. 1 root root 21 Apr 11 18:10 .gitattributes
-rw-r--r--. 1 root root 168 Apr 11 18:10 .gitignore
-rw-r--r--. 1 root root 641 Apr 11 18:10 .gitlab-ci.yml
-rw-r--r--. 1 root root 174 Apr 11 18:10 .travis.yml
-rw-r--r--. 1 root root 3687 Apr 11 18:10 CONTRIBUTING.md
-rw-r--r--. 1 root root 35147 Apr 11 18:10 COPYING
-rw-r--r--. 1 root root 515 Apr 11 18:10 Dockerfile
-rw-r--r--. 1 root root 94 Apr 11 18:10 MANIFEST.in
-rw-r--r--. 1 root root 4269 Apr 11 18:10 README.rst
drwxr-xr-x. 2 root root 4096 Apr 11 18:10 bin/
drwxr-xr-x. 5 root root 4096 Apr 11 18:12 debian/
drwxr-xr-x. 5 root root 4096 Apr 11 18:13 diffoscope/
drwxr-xr-x. 2 root root 4096 Apr 11 18:10 doc/
-rw-r--r--. 1 root root 138 Apr 11 18:10 pyproject.toml
-rwxr-xr-x. 1 root root 2339 Apr 11 18:10 setup.py*
-rw-r--r--. 1 root root 800 Apr 11 18:10 test2.hdf5
drwxr-xr-x. 5 root root 4096 Apr 11 18:11 tests/
The question are:
- what is not needed inside the container?
- what are the use-cases for the container? only running diffoscope? what about running tests? etc..
list of file to possibly ignore:
[git files] - all .git* files, as git not installed inside the container.
[docker files] - .dockerignore & Dockerfile
[test] - are tests files needed?
[docs] - .md / rst files?
example of possible .dockerignore contents:
.*
Dockerfile
test*
*.md