How to improve build times
Does someone know of a way to use caching in docker using dokploy? or a different way to make builds faster?
My builds take up to 20m now and I'm looking for a way to optimize them
Any docs would also be appreciated
10 Replies
Why is taking so much time to build, is a big application?
Yep, pretty big
https://hub.docker.com/layers/metabase/metabase/v0.50.24.4/images/sha256-d09c6a710f384e97ec475ee068d8027280699387a0cb43111e4ac16f4be7a629?context=explore
It uses clojure, reactjs and compiles everything together on a single executable
Got it, and you are building the image in your dokploy server right?
Yes
Docker by default cache when you build for the first time, the second one should be more fast
just of curiosity what are the resources you have?
I think a better approach would be to do the build on a ci/cd and then push it to dockerhub, and then have dokploy just download the image and run it
also are you using nixpacks or your own dockerfile?
8 vCPU 16GB RAM
There are 2 steps in my build process that always take a really long time
#12 DONE 218.8s
#13 DONE 661.0s
It always happens, no matter how many times I deploy the project
The big offender is running the Build Script, compiling the code and creating the uberjar
My own dockerfile (attached as text)
I'll try your solution, at the very least it will help a lot on redeployments
Thanks!
the resources are enough, the dockerfile I see you are using stages which is very ideal for faster and small images
but the thing if your app is really big probably the optimizations that you can make will be kinda dificult to make it