Skip to content

jplane/dotnet-core-and-mongo-containers

Repository files navigation

Deploying an ASP.NET Core + MongoDB app to local Docker and remote Azure Container Service (w/ Kubernetes)


Prerequisites:


UPDATE: Here's a screencast of these demo steps in action... https://channel9.msdn.com/Blogs/MVP-Azure/Containers-Two-Ways


  1. build web api app from command line

    • dotnet restore
    • dotnet build
    • dotnet publish -o published
  2. build docker image locally

    • docker build -t {YOUR-DOCKER-ID}/the-app .
  3. run docker image + mongodb locally

    • docker run -d -p 27017:27017 --name mongodb bitnami/mongodb:latest
    • docker run -d -p 80:80 --name webapi --link mongodb {YOUR-DOCKER-ID}/the-app
  4. push app container to Docker Hub

    • docker login
    • docker push {YOUR-DOCKER-ID}/the-app
  5. use Azure CLI to connect to ACS cluster

    • az login
    • az account set --subscription "{YOUR-AZURE-SUBSCRIPTION-ID}"
    • az acs kubernetes get-credentials --resource-group="{YOUR-ACS-RG-NAME}" --name="{YOUR-KUBE-ACS-NAME}"
  6. push mongo service

    • kubectl apply -f mongo.service.yaml
  7. push mongo deployment

    • update mongo.deployment.yaml
    • kubectl apply -f mongo.deployment.yaml
  8. push app service

    • kubectl apply -f app.service.yaml
  9. push app deployment

    • update app.deployment.yaml
    • kubectl apply -f app.deployment.yaml
  10. admin UI

    • kubectl proxy
    • localhost:8001/ui

About

A demonstration of ASP.NET Core + MongoDB in containers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages