johnnymo87 / create-react-app-docker

https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html with docker
24 stars 7 forks source link

Simplify setup #2

Open johnnymo87 opened 7 years ago

egor-miasnikov commented 7 years ago

@johnnymo87 perfect, it works for me, even it check changes, but it installs all modules on my host machine instead of the container.

johnnymo87 commented 7 years ago

@j0gurt Try this: add RUN npm install to the dockerfile before the CMD line, remove npm install && from the CMD line, and build the image. If you run the container without a volume, you will see node_modules inside the container but not your local machine. If you run the container with a volume, the lack of node_modules on your local machine will make the node_modules in the container disappear. So if you want to develop with a volume, you have to have node_modules on your local machine one way or another. If you don't want to develop with a volume, you will have to rebuild the image every time you change anything.