question

ClaesYlving-8309 avatar image
0 Votes"
ClaesYlving-8309 asked ClaesYlving-8309 commented

Blazor client in Docker container

I have VS 2019 Version 16.10.1, Docker Desktop
1. Create new project, choose Blazor WebAssembly App (.NET 5.0)
2. Right click project in solution explorer choose Add-> Docker Support and choose Linux
3. Compiles fine and runs when you select "IIS Express"
4. Choose Docker instead of IIS Express and run


Fails with a dialog stating
"The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core."

Can not get it to work.

Regards

dotnet-aspnet-core-blazordotnet-ad
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Did you asuccessfully createted a nginx.conf in the root folder?

0 Votes 0 ·

1 Answer

Bruce-SqlWork avatar image
2 Votes"
Bruce-SqlWork answered ClaesYlving-8309 commented

a blazer web assembly app is a static website. it requires a Web server to host it. so to deploy to docker container, you need to pick a container with web server support (typically ngnix), and copy the wwwroot folder to a location folder defined in the webserver.

the default docker public assumes you are building a .net core app.

assuming you are in the built wwwroot folder, create a docker file like:

FROM nginx:alpine
COPY . /usr/share/nginx/html

that should do it. if you google, you could create a script to build and deploy. if you add a Dockerfiles you can run from the project file.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Well gee, thanks.. That was a bit embarrassing. I had a look at the generated Dockerfile and it did not include a viable image.. I didn't even think of checkng that. Goes to show how used one is getting to all the autogenerated stuff.

Thanks again!

0 Votes 0 ·