DEV Community

Discussion on: Run a React App in a Docker Container

Collapse
 
rrmontuan profile image
Ricardo Montuan • Edited

Is it common to run the create-react-app command on the host machine or there's another way to do that (I mean inside the container)? We also have to consider that we could need some other dependencies inside our package.json. Do you know how to deal with that?

Collapse
 
peterj profile image
Peter Jausovec

Usually, you would run create-react-app once, outside of the container on the host machine, just to create your app.

yarn build command takes care of the dependencies - on line 3 I am copying everything (package.json included) to the builder container, then yarn build does its magic and takes care of any dependencies that are needed.

Does that answer your questions?