Skip to content

juliuskrah/AirportExplorer

Repository files navigation

Airport Explorer

To get started quickly, set environment to Development:

C:\> set ASPNETCORE_ENVIRONMENT=Development
C:\> dotnet restore
C:\> dotnet run

Add Packages

To add a new package run the following command:

C:\> dotnet add package <package-name>

Manage Secrets

Development Secrets: https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?tabs=visual-studio-code
Production Secrets: https://blog.matjanowski.pl/2017/11/18/managing-options-and-secrets-in-net-core-and-docker/

Deploy to Heroku

To deploy to Heroku you need the following:

  • Docker

  • Heroku CLI

  • Heroku account

  • ASP.NET Core 2 Runtime

  • Publish your app:

    C:\> dotnet publish -c Release
  • Add a Dockerfile to the root of your project: In the root of your project, add a file called Dockerfile (no extensions) and place the following in it:

    FROM microsoft/aspnetcore
    WORKDIR /app
    COPY . .
    CMD ASPNETCORE_URLS=http://*:$PORT dotnet <AssemblyName>.dll
    

    Be sure to replace <AssemblyName> with the name of your project assembly e.g. AirportExplorer

  • Copy the Dockerfile to your publish directory Your publish directory should be:

    ${ROOT}/bin/release/netcoreapp2.0/publish
    
  • Build the Docker Image

    C:\> docker build -t <image-name> ./bin/release/netcoreapp2.0/publish

    Be sure to replace <image-name> with the name you intend to give the image e.g. airport-explorer

  • Create the app on Heroku using the dashboard

    1. Make sure you have a heroku.com account
    2. Login to the dashboard and create the app
  • Be sure you are logged in to heroku and its container registry

    C:\> heroku login
    C:\> heroku container:login
  • Tag the heroku target image

    C:\> docker tag <image-name> registry.heroku.com/<heroku-app-name>/web

    Be sure to replace <heroku-app-name> with the name of your heroku app e.g. sample-app

  • Push the docker image to heroku

    C:\> docker push registry.heroku.com/thrails/web
  • Check that your app works

    C:\> heroku open -a <heroku-app-name>

Resources

Docker + ASP.NET Core https://docs.docker.com/engine/examples/dotnetcore/
Docker https://docs.docker.com/get-started/