Closed ptahchiev closed 4 years ago
try adding a .dockerignore
file to reduce the amount of files that have to be sent to your docker daemon in order to build an image
I'll give it a try, although it looks dumb - I have to virtually exclude every single file besides the target/app.jar
. The better solution would be to include the target/app.jar
and by default have everything excluded. This contextDirectory
is super stupid idea.
Well the stupid idea is all on Docker's side, it will send everything in your "context" to the daemon so it can build an image out of your Dockerfile unless you explicitly tell it to ignore stuff. If you take a look at the docs, you can put something in your .dockerignore
file like:
target
!target/app.jar
to ignore everything under target except a given path
So I have the following layout (super standard maven build):
I have configured the dockerfile-maven-plugin as such:
now when I run
mvn dockerfile:build
every time it takes 2 minutes before it even start building the image!!!!! I think it is because it tries to add all the files in.
as.
is mycontextDirectory
. But I have no other option - myDockerfile
is insrc
and my.jar
file is intarget
so my only option is to have thecontextDirectory
as.
. Am I right? How can I make it faster?