Prerequisites:

Create your web application:

First, we will create a new MVC application with .NET Core 3.1 Framework and run it to see that everything went correctly.

Image for post

If everything went well we should be able to navigate through the default address https://localhost:5001

Image for post

Create, build and run your docker image:

Create a file called Dockerfile in the root of your application. And configure your image.

Image for post

If you are familiar with Docker files you may wonder why we don’t **EXPOSE **any port. The reason is that Heroku hopes to handle the ports for us mainly for security reasons. We will also have to change the code of our application to be able to listen to the requests for the port that Heroku assigns us.

#docker #deploy #heroku #dotnet #devops

Deploy Your .NET Core 3.1 Application to Heroku With Docker
7.45 GEEK