Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Docker development environment not rebuilding after local changes. #1041
I currently have a container set up with FuseBox for development. I am able to hit localhost:4444 and load the page but when make changes on my local drive nothing rebuilds so even when I refresh the page manually nothing changes.
From past experience after pulling hair for a day or two when I was setting up a live development environment working with Docker + Webpack I eventually learned that the legacyWatch mode that invokes file polling in Webpack had to be turned on for file polling for the container in order to watch files and rebuild. I have a Docker image that works perfect for development using Webpack and it really was only that legactWatch mode if that helps.
The same goes with using nodemon with Docker. You have to create the nodemon config and set legacyWatch to true. It has to do with different file systems.
Also, I do not know how to change the port the WebSocket connects to. It seems to only like port 4444. I changed the port for the dev server and the socket continued to want 4444. No big deal but may arise in the future.
docker-compose.yml to start container and map volume to directory:
Working Dockerfile with node-sass (pain in the ass to figure out so it may help others) built in:
So instead of:
Ditch the .watch() and utilize Sparky manually instead something like this?
Shouldn't this be an option of the dev server for much easier configuration and to ensure consistent setup?:
When and how to create/hot-update a bundle when manually watching is still confusing since I do not have a full understanding of the inner workings of FuseBox due to having only been using it for two days.
I still need help getting hmr to work from a docker container.
docker start command:
@nchanged So I got it working. Thank you! However, there is a caveat. The client only connects when using port 4444 for the dev server. Even if the docker container is mapped using a different port for host:container like 9000:4444 it still requires everything to be set to port 4444 (4444:4444).
For anyone else that uses bot docker and non-docker environments, here are the task that I made so that I can still take advantage of non-polling environments: