Build takes time , any recommendations to bring this time down

In our use case , we are using qt application with opencv & various other dependencies which takes around 40 minutes to setup & install but works fine.

Now while testing , we need to make some changes in configuration & setup files and push again to app , in this case app again start same process of installing opencv & various other dependencies which again takes ~40 minutes , any recommendation that we can skip repeated installation / building process and reuse same setup which was done previously ?

Hey @yyogeshwar

If possible can you please share your current build steps so we have more context and be able to give you some recommendations?

Are you currently using multi-stage build?

Thanks
Rahul

high level details - we are compiling multiple big libraries like boost & qt from source in ubuntu:bionic image
these time consuming compilation steps happens at every deployment , so we would like to avoid these steps every time.

RUN ./install.sh
Using above command in Dockerfile , we are calling all above steps.

@rahul-thakoor

Hey @yyogeshwar,

By running RUN /.install.sh you are not able to leverage the caching capabilities in docker. Perhaps the documentation here might be helpful?

I would suggest running the build steps in your Dockerfile so that the relevant layers are cached and will make subsequent builds faster. If possible you can also try and see if you can use multi-stage builds.

Regards,
Rahul