I have a solution with some projects like an WPF app, a .net class library and a console program. I have just added a new Blazor project. I chose the “Blazor Web App” with interactivity WebAssembly and location per component. The template generated a two projects. One with the name I gave, and one with the “Client” suffix.
When I hit play in Visual Studio it does everything from compile to starting the host and opening my browser so that I see the beautiful “Hello World” site.
Now I want to host this app in docker on a linux machine.
For this I wrote this docker file:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
COPY . .
RUN dotnet restore PvPower.WebApp/PvPower.WebApp/PvPower.WebApp.csproj
RUN dotnet restore PvPower.WebApp/PvPower.WebApp.Client/PvPower.WebApp.Client.csproj
RUN dotnet publish PvPower.WebApp/PvPower.WebApp/PvPower.WebApp.csproj -c release --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:8.0
COPY --from=build PvPower.WebApp PvPower.WebApp
COPY --from=build PvPowerReader.sln PvPowerReader.sln
ENTRYPOINT ["dotnet", "run --project PvPower.WebApp/PvPower.WebApp/PvPower.WebApp.csproj --no-build -c release"]
But I get the following error message:
The command could not be loaded, possibly because:
* You intended to execute a .NET application:
The application 'run --project PvPower.WebApp/PvPower.WebApp/PvPower.WebApp.csproj --no-build -c release' does not exist.
* You intended to execute a .NET SDK command:
No .NET SDKs were found.
Download a .NET SDK:
https://aka.ms/dotnet/download
Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
The error is pretty straight forward: dotnet run
is not available in the aspnet-image I chose. But I don’t want to use the fat (800MB) sdk-image, because I read somewhere that I could use nginx:alpine with just 5MB footprint.
But the reason I am using dotnet run
is, that with the command dotnet PvPower.WebAppPvPower.WebAppbinDebugnet8.0PvPower.WebApp.dll
I just get this site, where it seems that something is missing.
So my ultimate goal is to get a docker file to run my web app. But I would also like to understand why dotnet PvPower.WebAppPvPower.WebAppbinDebugnet8.0PvPower.WebApp.dll
does not work.