Docker container doesn't reload Angular app

后端 未结 5 669
忘掉有多难
忘掉有多难 2020-12-01 18:32

I have some issue with ng serve in my docker container running by docker-compose.

Dockerfile

FROM node:7.1

RUN mkdir -p /u         


        
5条回答
  •  长情又很酷
    2020-12-01 18:48

    A solution can be the chokidar wrapper, which is a dependency of the angular package. I dont know, if that was the status in 2017. You don't need to expose any extra ports. Just use an environment variable in your docker-compose.

    Basic configuration:

    Dockerfile

    CMD ng serve --host 0.0.0.0
    

    docker-compose.yml

    environment:
      - CHOKIDAR_USEPOLLING=true
    

    This should hot-reloading your browser. Tested on Chrome and Angular 8

    Package for further investigation: https://github.com/paulmillr/chokidar

提交回复
热议问题