Using a container just to populate a volume during compose

I have a lot of code that needs to be downloaded and compiled during my build process;

For some reason, I’ve settled on having a container defined in my Docker-Compose whose sole purpose is to download these repositories, and spit out the optimized code into a Volume so that different containers can utilize it.

Just wondering, this probably isn’t “best practice”, but is it an accepted practice?