Also I just noticed this is about the craziest dockerfile. It's all one RUN which good luck trying to troubleshoot if theres a non obvious error during building
That said, recent versions of docker do have the ability to squash layers at the end of a build which could give the best of both worlds.