Multi staged build that builds 20 cpp dependencies from source

Hey
I am currently trying to create a multi staged build that is building a lot of cpp dependencies from source but also installing a lot og apt packages.

I was wondering what the best setup would be and how the structure of the stages should look like if I easily want to add an apt package without having to build the hole dockerfile again from scratch.
Thanks