dotnet-presentations / blazor-workshop

Blazor workshop
https://aka.ms/blazorworkshop
MIT License
3.49k stars 1.55k forks source link

please include docker with nginx example #235

Open rclarke2050 opened 4 years ago

rclarke2050 commented 4 years ago

please could you include a docker image behind nginx of both a blazor webassembly and a blazor server app. That would be very helpful for those of us using containers either through azure/aws/k8s.

thanks

lohithgn commented 3 years ago

@rclarke2050 can you elaborate more on nginx of both a blazor web assembly & a blazor server app?

From my understanding - the hosting model showcased for the Blazor WASM app in the workshop is that of what we call ASP.NET Core Hosted. What it means is, the BlazingPizza.Server is going to be serving the static assets. The static assets in our case are the Blazor WASM app(or BlazingPizza.Client). So you could just create a docker image out of BlazingPizza.Server.

Are you suggesting that this workshop be enhanced to include a Docker file out of the box?

lohithgn commented 3 years ago

@rclarke2050 if you are using Visual Studio 2019 on Windows, you can install an extension called VS Tools for Docker https://docs.microsoft.com/en-us/dotnet/architecture/containerized-lifecycle/design-develop-containerized-apps/visual-studio-tools-for-docker. After this right click on BlazingPizza.Server project in your solution explorer, select Add > Docker Support. This will generate a Dockerfile for you. And if you have installed Docker Desktop - VS will create a Docker profile for BlazingPizza.Server project. Just run that profile - it will build the docker file, generate the image locally and run it in a container. You can watch the container within VS itself. Here is what it looks in my machine: image

lohithgn commented 2 years ago

@rclarke2050 did you get a chance to check my responses above. If this is no longer an issue for you, do consider closing this issue. Thanks.

RobCannon commented 2 years ago

I find that when I try to run this in a dockerfile, that I can't get it to run because IdentityServer wants a license key. Adding this environment variable seems to help with that:

ENV ASPNETCORE_ENVIRONMENT=Development