question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WebSPA Development in docker-compose Question

See original GitHub issue

I 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:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
DKANomadcommented, Sep 12, 2022

@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

0reactions
Hadsencommented, Sep 21, 2022

Microsoft.AspNetCore.SpaServices is obsolete. This project uses Microsoft.AspNetCore.SpaServices.Extensions, which is an actual replacement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - How to connect API with Web SPA through docker
1 Answer 1 ... If you want to start all of your apps with a single command using docker, the only option is...
Read more >
WebSPA is not running on debug mode in visual studio 2019
I noticed when hit F5 to debug eshoponcontainer the following events happen: 1- It builds an image with dev tag 2- WebSPA browsing...
Read more >
06. (Optional) Setting the Web SPA application up
Important notice. The Web SPA application currently builds just fine while building the Docker images with docker-compose.
Read more >
Top 25 Docker Interview Questions and Answers for 2023
Application agility; Developer productivity; Easy modeling; Operational efficiencies; Placement and affinity; Version control. 3. Why should ...
Read more >
Top Docker Interview Questions and Answers (2023)
Learn and Practice on almost all coding interview questions asked historically and get referred to the best tech companies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found