Docker Community Forums

Share and learn in the Docker community.

Dockerized angular app : long "compile on save"

Hi,

I dockerized the ngx-admin Application on an ubuntu VM
With my PC (Windows) I can view the interface on ‘http://192.168.xxx.xxx:2007’.
The “problem” (if it’s one) is that I think the “compile on save” is really long : it takes about 40 to 45s to reload the interface after a file has been modified.

I tried to do it locally (on Windows, without docker and run it with “ng serve”) and it only takes 10 or 11 seconds, so I’m wondering if I correctly setup the container.
Is it normal that it takes so long in a container ? Or have I missed something in the container configuration ? How can I not wait 40 seconds every time I change something to see the modifications ? (it’s to long for me)

Thanks in advance!

Container configuration

My Dockerfile (location = /www/pathToDockerFiles/ngx-admin)

FROM node:12

RUN mkdir /www
WORKDIR /www

EXPOSE 4200
CMD npm run start
# in package.json = "ng serve --host 0.0.0.0"

My docker-compose.yml file (location = /www/docker-compose.yml)

my-front:
  image: my-ngx-admin
  ports:
    - 2007:4200
  volumes:
    - ./pathToAppsFolders/my_front:/www/

Commands :

1.Get sources and install :
git clone https://github.com/akveo/ngx-admin.git /www/pathToAppsFolders/my_front && cd /www/pathToAppsFolders/my_front && npm install
2. Build the image
cd /www/pathToDockerFiles/ && docker build -t my-ngx-admin -f ngx-admin .
3. Up containers and display
docker-compose up -d && clear && docker ps -a