Support angular 5 hosted with nginx
Granga opened this issue · 2 comments
My application is consisted of angular 5 client, nodejs api, mongo db, and nginx.
From my understanding, I should include my angular dist files in the nginx image, but I'm not sure.
What is the most suitable way to include my angular 5 dist files?
Hey @Granga ,
There are 2 approaches I'd recommend. Note that building your entire application in NoDock is the best option for simplicity's sake and environment consistency.
Frontend Development Inside NoDock
If you're using a task runner/bundler for your client app and you want to run it within NoDock, the simplest option is to mount the source files in the workspace
service (add a volume in the docker-compose.yml).
Expose the port your bundler/task runner uses to serve the files in development.
Add a reverse proxy on the existing NGINX site config.
You can then run the client manually inside the workspace container
docker-compose exec workspace npm install
docker-compose exec workspace npm run dev # or whatever the build command is
Frontend Development Outside NoDock
Essentially what you said, simply mount a volume on the nginx service that points to the dist folder on your host and modify the NGINX configuration to serve it.
I hope this helps and do let me know how it goes! 🚀
I went with the second option for now, because of how my environment is setup.
Thank you.