在Windows中的角度项目中更改任何内容时Docker都不会重新编译 [英] Docker is not recompiling upon changing anything in angular project in windows

查看:111
本文介绍了在Windows中的角度项目中更改任何内容时Docker都不会重新编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试对我的有角度的应用程序进行对接,为此,我创建了一个Dockerfile.但是,每当我尝试编辑或更新任何组件时,都不会重新编译我的角度应用程序.这是dockerfile:

I am trying to dockarize my angular app and for that i have created one Dockerfile. But whenever i tried to edit or update any component its not recompiling my angular app. here is the dockerfile:

FROM node:latest

RUN mkdir /usr/src/app
WORKDIR /usr/src/app

RUN npm install -g @angular/cli

COPY . /usr/src/app

RUN npm install
CMD ng serve --host 0.0.0.0 --port 4200

在docker运行期间,这里是我使用的命令.

And during docker run here is the comand that i use.

docker run -it -v ${PWD}:/usr/src/app -p 4200:4200 angular-docker-image

有人知道为什么它不起作用吗?我现在该怎么办?

Any idea why its not wroking and what should i do now?

推荐答案

Windows家族(Docker工具箱)或Windows Linux子系统

在Docker Toolbox或WLS上运行时,Windows的文件更改事件系统不会在VM(或子系统)中触发任何事件,因此不会通知观察者.

When running on Docker Toolbox or WLS, the file changement event system of Windows will not trigger any event in the VM (or Subsystem) so the watcher will not be informed.

Windows在内部版本的Insider程序中进行了更新.#14942 ,但仅适用于Windows记事本...

Windows made an update in the Insider Program on the build #14942 but it only works on the Windows notepad...

Windows Professional

如果您正在使用Windows Professional并使用Docker For Windows,则它是

If you are working on Windows Professional and using Docker For Windows, it's a known issue.

解决方法是使用文件监视程序的轮询功能.对于Angular:

ng serve --poll< period_in_ms>

这篇关于在Windows中的角度项目中更改任何内容时Docker都不会重新编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆