0

Disclaimer: Potential Noob Question - I might have misunderstood something very fundamental!

I have created a new website using Visual Studio 2022 Professional. I have used the template `React and ASP.NET Core - Typescript". This creates a solution with two projects. A server application in .NET 8.0 (LTS) and a client project that is a react frontend with Vite support. A sample endpoint exposes random weather forecast data and this is visualized in the React App.

When I press F5 two browser windows open up. One with the API spec (Swagger) and one with the react app. Vite is started using npm run dev.

Now I want to change this to run using Docker compose. This is so I can run a SQL Server 2022 in a container of its own and start developing endpoints that expose data from a database. I right click on the server project and select "Add"/"Container orchestration support".

But I never get this far. Once I have added container orchestration support, the Vite server doesn't start again. When I press F5 only the swagger definition appears.

What am I missing here? Why doesn't Vite start? I can't navigate to https://localhost:5173/

Am I doing something fundamentally wrong? Should I not use Docker compose at all? Is it a wrong approach to want to get the SQL 2022 dev server up and running in Docker compose? Or is there a simple checkbox I just forgot to check?

1 Answer 1

0

After some experimenting, I think I found a solution.

Instead of running my frontend app in a container, I configured my solution to have multiple startup projects. The two projects are docker-compose and my front end client. That starts up both browsers on F5.

Another perk of using docker compose is that I can map the port of the API to a static port, so it doesn't change on every startup, and I can map the API target in my vite.config.ts.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.