I\'m not able to find many examples of what a .dockerignore file should look like.
Using puppet to install a few packages on a docker container causes the image to
A different way of doing it, creating a smaller image, is to run librarian-puppet in the host, not in Docker, so you don't end with librarian, ruby, gems,... installed in the image.
I ended with a 622MB image for jenkins slave using Puppet, and a 480MB image without Puppet.
I think the best solution for your use case is to use a Multi-stage build in your docker file. Your Dockerfile must be in an empty directory, and you run puppet in a disposable container.
From the link above:
With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.