Deploying ASP.NET Core Apps on Heroku servers Containerized — Straight Forward.

  1. Setting up your .Net App Project ready for deployment to Heroku.
  2. Configure your Docker file the right way.
  3. Set up Github actions for CI/CD.
  4. Adding .Net Core 3.1 Build pack to Heroku.
  5. Configuration on Heroku server.
  1. How to write your .Net App :) .
  2. How to push to Github .
  3. And the other stuff you feel is missing :) lol.

Project Set-up for Deployment:

Configure your Docker file ready for deployment:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS baseWORKDIR /appEXPOSE 80EXPOSE 443FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS buildWORKDIR /srcCOPY [“cryptor/cryptor.csproj”, “cryptor/”]RUN dotnet restore “cryptor/cryptor.csproj”COPY . .WORKDIR “/src/cryptor”RUN dotnet build “cryptor.csproj” -c Release -o /app/buildFROM build AS publishRUN dotnet publish “cryptor.csproj” -c Release -o /app/publishFROM base AS finalWORKDIR /appCOPY — from=publish /app/publish .ENTRYPOINT [“dotnet”, “cryptor.dll”]
CMD ASPNETCORE_URLS=http://*:$PORT dotnet cryptor.dll

Setting up Github Action:

Adding .Net Core 3.1 Build pack to Heroku:

https://github.com/jincod/dotnetcore-buildpack

Configuration on Heroku server:

--

--

--

I’m a .Net Engineer, I build disruptive solutions, contribute to the community, student ambassador @Unity, learn student partner @Microsoft and aspiring MVP.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

{UPDATE} Pic Mix - Combo the pics to guess the word! Hack Free Resources Generator

What’s New — March 21, 2022

Spark KUDO — D2IQ-Cloudera Storage vs. Compute

We partnered with our friends from Chainsafe!

Data Pipeline Architecture

DevOps Practices in a nutshell

Spiral Knights Trinket Slot Upgrade

Tool

Junior-Senior IOS Developer Interview Questions

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Onyekwere Kelechi Mark

Onyekwere Kelechi Mark

I’m a .Net Engineer, I build disruptive solutions, contribute to the community, student ambassador @Unity, learn student partner @Microsoft and aspiring MVP.

More from Medium

Add MVC Controller With Views using Entity Framework in NET 6

How to make a movable control in Avalonia?

Unix Domain Sockets in .NET 6 — Basics and Real-World Examples

Deploy a .NET CORE(5.0/6.0) API on Linux (Ubuntu — EC2 on AWS) — Basic Steps.