This repository aims to work as a template to deploy .NET Core apps to Heroku inside a Docker container.
NET SDK
Docker Desktop
Heroku CLI
- Open Visual Studio IDE.
- Select
local
git branch. - Press F5 to run the solution (you can select either Docker or IIS Express as lauchers).
Alternatively you can open a terminal window, navigate to the app's directory and execute dotnet run
. Then you can open a browser and go to https://localhost:5001/swagger
- Open a terminal window and navigate to the solution directory.
- Run
docker build -t netcore-docker-heroku .
At this point you can try to run the application locally with the command docker run -it --rm -p 5000:80 -e ASPNETCORE_ENVIRONMENT=Development netcore-docker-heroku
and then browse http://localhost:5000/swagger
- Go to https://heroku.com/ and create an account, or login if you already have an account.
- In our Dashboard, go to the New button and then Create new app.
- Name your application and then press Create app.
- Select the Deploy tab and under Deployment method select Container Registry
- Follow the instructions.
For the push and deploy steps, you need to add -a <APPLICATION-NAME>
at the end of the command.
- Press the Open app button and navigate to the /weatherforecast endpoint
- (OPTIONAL) Go to Settings>Config Vars>Reveal Config Vars and add the Key:Value ASPNETCORE_ENVIRONMENT:Development. Restart the pool, and now you should be able to use Swagger in your deployed application!