How to install theme dependencies to docker

I want to create a docker-image for a hugo-site and use cached modules inside the container.
Now I manually copy the cache directory into the docker-image. I works, but I want to make it more distributable.
How can I install the theme dependencies to a certain directory if I have a list of modules?