Is it possible to upload blazor webassembly applications with . net core hosted on Herokuapp via Docker?

Asked

Viewed 95 times

0

When I go up a blazor server application, I use the following steps:

  • I create a dockerfile file in the same folder where the project is so:

    FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base

    WORKDIR /app

    COPY . .

    CMD ASPNETCORE_URLS=http://*:$PORT dotnet NomeAplicativo.dll

I open cmd in the project folder and give the commands;

  • dotnet publish -c release
  • heroku container:login
  • docker build -t {nome do aplicativo heroku} {caminho da pasta publish (com duas barras em vez de uma\\)}
  • docker tag {nome do aplicativo heroku}
  • docker tag {nome do aplicativo heroku} registry.heroku.com/{nome do aplicativo heroku}/web
  • docker push registry.heroku.com/{nome do aplicativo heroku}/web
  • heroku container:release web --app {nome do aplicativo heroku}

And that’s it! My app is running smoothly on Heroku. Just like this one http://selesgabriel.herokuapp.com

Before starting the steps, I copy the same Docker file to the folder where Publish is and only then start the Docker build

But when I try to do the same to blazor webassembly with . netcore hosted, does not work, by giving the command 'Docker run -p 8124:80 testeblazorapp' in cmd inside the Publish folder to see if the app is working normally, just like it happens on blazor server, it gives the following msg:

It was not possible to find any installed . NET Core Sdks Did you Mean to run . NET Core SDK Commands? Install a . NET Core SDK from: https://aka.ms/dotnet-download

I looked hard, but I couldn’t find anything. And when opening the Heroku app appears that msg as if it had no website on it, and when I run the command 'Docker run -p 8124:80 testeblazorapp', it gives the msg as in the msg I put below.

inserir a descrição da imagem aqui

  • I forgot one thing, before starting the steps, I copy the same Docker file to the folder where Publish is and only so start the Docker build.....

  • Edit your question and also ask what error message appears.

  • Thank you! I put more information there

  • How was the project created? In Visual Studio, selecting the option Blazor WebAssembly App (unscheduled ASP.NET Core hosted)? Ou linha de comando com dotnet new blazorwasm`? Or in any other way?

  • Please note that you say webassembly com .netcore hospedado. In this case, I think the project was created in Visual Studio with Blazor WebAssembly App and you scored the ASP.NET Core Hosted option. Right?

  • I created in the same visual studio. And this procedure I did both with the ASP.NET Core Hosted option marked and also with the unchecked option. Both don’t work out.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.