(Now the actual blog post for Bingo Meetings project)
Now what I want to achieve is to run the WebAPI and Angular Site in docker. For this, we should compile the Angular site and copy into the WebAPI. Also, WebAPI should serve the index.html file generated by the Angular.
Those are the 4 steps:
1. Ensure that the Angular routes and WebAPI routes should be different Solution: this is easy achieved by having /api prepended to the WebAPI routes)
2. The WebAPI should be configured as to build to different configurations: for our purpose, calling root ( /). For docs ( https://alexandru360.github.io/PresentationBingoCards/ ) it should call official deploy http://bingo-meeting-api.herokuapp.com/api/
Solution: read about environment https://angular.io/guide/build . I have made a new environment dockerbuild Rememeber to create a new environment.ts + a new entry in angular.json to build this configuration + an entry in package.json to build it . Then modify the service to use environment( see the modifications at https://github.com/alexandru360/PresentationBingoCards/commit/6dafb0c0b005d46bc426d128f9caf5d53e039dfa ).
3. For NestJs to serve html file , add nest-middlewares/serve-static , then add the following code in the appropiate places:
rootPath: join(__dirname, ‘..’, ‘dist’,’bingo-cards-ui’),
4. In the docker compile the Angular , then copy the files into WebAPI folder, then run the WebAPI site . See https://github.com/alexandru360/PresentationBingoCards/blob/master/dockerize/docker_runwebapiweb.txt and https://github.com/alexandru360/PresentationBingoCards/blob/master/dockerize/build_RunWebApiWeb.bat