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
Siumauricio
Siumauricio8mo ago
Why is taking so much time to build, is a big application?
EAlcazar
EAlcazarOP8mo ago
Yep, pretty big
Siumauricio
Siumauricio8mo ago
Got it, and you are building the image in your dokploy server right?
EAlcazar
EAlcazarOP8mo ago
Yes
Siumauricio
Siumauricio8mo ago
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?
EAlcazar
EAlcazarOP8mo ago
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
EAlcazar
EAlcazarOP8mo ago
My own dockerfile (attached as text)
EAlcazar
EAlcazarOP8mo ago
I'll try your solution, at the very least it will help a lot on redeployments Thanks!
Siumauricio
Siumauricio8mo ago
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

Did you find this page helpful?