I’ve already spent several hours on this issue and for the life of me, I can’t seem to figure out what why it isn’t hot reloading when changes are made.
I created an angular project from the cli as a child directory. The idea is that I’ll have multiple projects at the root level and that there will be multiple docker containers spun up at the same time
Project/ client/ docker-compose.yml
client folder contains my angular project created from the cli. It has a dockerfile to build the container
// ./client/Dockerfile FROM node:14.5.0 RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' RUN apt-get update && apt-get install -yq google-chrome-stable WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH COPY package.json /app/package.json RUN npm install RUN npm install -g @angular/cli@latest COPY . /app CMD ["ng","serve","--host","0.0.0.0", "--disableHostCheck=true", "--poll", "100"]
The docker-compose file kicks the container build at the root level
// ./docker-compose.yml version: '3.7' services: client: build: context: ./client dockerfile: Dockerfile volumes: - '.:/app/client' - '/app/client/node_modules' ports: - '4201:4200'
The build context needs to be set to the project folder so it can be properly bound. When I run docker-compose up command, the angular startup kicks fine. However, if I try changing a file within the
client folder, nothing happens in the terminal and of course the application doesn’t get reloaded.
What’s odd is that when the docker-compose file is within the client folder and it’s kicked off, the live-reload works just fine. This is leading me to believe that this maybe docker container issue as maybe the host directory is not bound right? I’m really lost and confused here
If anyone who works with docker on a regular basis could help me here, That would be really great.