I have an ASP.NET Core Web API and a Blazor Wasm application, both in .NET 8. I want to dockerize both applications in the same image and map them to different ports.
I’ve created images for Web APIs and Blazor apps before, but in different images.
The reason to do this is because the Blazor app it’s a tiny app that allows to see some data of the app.
Any idea how can I do this?
I’ve searched a little bit and I came up with this:
// Configure Kestrel to listen on two ports
builder.WebHost.ConfigureKestrel(options =>
{
options.ListenAnyIP(5000); // API port
options.ListenAnyIP(5001); // Optional Web UI port
});
My questions are, why do I need to change the Kestrel configuration? It seems like the Blazor app will be served by the ASP.NET Core Web API, is this correct?
And most important how does the Dockerfile should look like?