Open aguibert opened 5 years ago
The problem here seems to be that we always call BuildImageCmdImpl(BuildImageCmd.Exec exec, InputStream tarInputStream)
which doesn't set a Dockerfile in the docker-java layer. Setting an explicit Dockerfile is what causes the corresponding .dockerignore
to be read.
To resolve this issue, we can call withDockerfile(File)
on the underlying docker-java API
I have the same problem with dotnet testcontainers. Any workarounds?
I'm also affected from this issue.
As this hasn't been resolved for several years now, does anyone know of a workaround?
Apart from the obvious one to not include everything and "manually" filtering out resources.
I guess if someone wants to have a look at it, starting with the suggestion by @aguibert sounds promising: https://github.com/testcontainers/testcontainers-java/issues/1534#issuecomment-499664588
For Docker build performance, it can be very important for certain projects to have a
.dockerignore
file so that extra content is not sent to the Docker daemon (which may be on a different machine).It appears that the underlying docker-java API does support
.dockerignore
files: https://github.com/docker-java/docker-java/blob/master/src/test/java/com/github/dockerjava/cmd/BuildImageCmdIT.java#L176However, if I try an invalid
.dockerignore
in one of my Testcontainers projects, then it does not appeared to be honored. I was able to confirm this with the following steps:.dockerignore
file like this:docker build .
and verify it fails