WebSPA Development in docker-compose Question
See original GitHub issueI have some questions regarding the WebSPA project, currently it seems like there isn’t really an easy way to work on this in the docker-compose environment. How would you debug the app in this environment? Or is that not the intent? If so I would be interested to know the correct approach
From the docs it seems that the solution to getting the SPA to even load is to just run it in Release, also when attempting to run it in a non-docker environment, and in debug, it can’t access the other services, meaning you don’t really get the advantages of SPA Proxy and live reload when making changes, in fact making changes requires a full image rebuild.
My confusion comes from the fact that based on how the code is written, the intent appears to be to run the Angular app and it’s ASP.NET Core app at the same time, but there doesn’t seem to be an easy way to do this while also making use of the docker-compose environment and the other services.
Expanding on from this I tried to see if I could conditionally add the SPA Proxy to the docker container to try and make changes to the Angular app while running in the docker-compose environment.
I experimented with getting the SPA Proxy to work in the docker container as mentioned in this documentation. Adding the environment variable for ASPNETCORE_HOSTINGSTARTUPASSEMBLIES
to the docker-compose.yml
does work and SPA proxy loads correctly, but when it redirects, the angular app can’t access the backend due to requests being made to a relative path (Same site).
I have also attempted to make use of the method mentioned here. Adding the DockerfileFastModeStage
attribute to the .csproj and the build stage to the Dockerfile. However it looks like this isn’t supported for docker-compose environments, only the single Dockerfile approach.
There’s a fair bit here but If anyone has some insights into these questions, I’d appreciate it.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
@erjain thanks for the response, my issue wasn’t so much being unable to run the project in debug, I was able to do it in both self-host and remote mode with some small modifications to docker-compose.
My questions were more specific to the approach used in maintaining the development environment. @Hadsen’s comment about using self-hosted mode works well enough. I also tried with running it in Docker as a single Dockerfile which ran but the Angular CLI kept timing out, I will keep messing around with it.
Thanks all for your responses
Microsoft.AspNetCore.SpaServices is obsolete. This project uses Microsoft.AspNetCore.SpaServices.Extensions, which is an actual replacement.