The usual solution is to mount folders using
-v option. It’s simple, easy to use and pretty reliable. Just add
-v "$(pwd):/root" and the current folder will be mounted to the
/root folder in the container.
Using volumes is nice because they’re (can be) two way and (can) sync in real-time. Now you don’t need to rebuild your image every time you fix a typo.
-v has pretty deep configuration options too, in case you want to go down the rabbit hole.