DEV Community

Discussion on: Using Docker Multi-stage builds during development

Collapse
 
maniqui profile image
Julián Landerreche

It's not clear what the VOLUME /app directive on Dockerfile is helping with. What's the goal of "exposing" the /app folder from within the container to the host? At which step are you (re)using that volume?

Also, in your docker-compose file you have:

volumes:
- .:/app

I understand that, for developing purposes (live reloading, etc), this directive will mount the project folder (from host) inside the container, "overwriting" the /app folder that you initially copied inside the image (for building purposes). Right?
What I'm missing is: how do you get all yarn dependencies installed when doing development tasks? Is "yarn run dev" enough to install them?

Yes, I see that you run "yarn install" during image build (for building/deploying purposes). But whatever that command install inside /app (assuming yarn stuff gets installed right there) is "overwritten" by the /app volume you are mounting for development purposes.

If you could clarify that (and maybe point to a Github repo that applies this workflow), that would be great.

Thanks.