tiangolo/angular-docker-multi-stage-example

Using ng serve instead of serving just with docker

Closed this issue · 2 comments

Hi,

I am trying to run two different docker environments. One for development, and one for production. For dev, I want it to update my sass files and compile my typescript like it does when running ng serve. My understanding though is running things in docker like your multi-stage repo here shows won't do that.

In addition, my app runs on web sockets as well so our usual approach to dev is to do:
ng serve
and then
node server.js

So we are serving the websockets as well as developing on port 4200.

Do you have some advice for how to achieve this?

Thanks!

Here's my advice, and what has worked for me and my team:

  • Develop your front end locally, with ng serve, npm run start, etc.

There isn't a simple way to have live reloading and several features if you do all the process inside Docker. I run my backend server in Docker even during development (especially useful to connect to DBs in other containers).

  • If you have a staging server and want to use a different Angular "environment" while deploying to a live server, you can use all this recipe. But for local development I've found easier to just use ng serve.

I assume that solved the question, so I'm gonna close this issue now.