During our Visual Studio 2017 Launch event this year, Scott Hanselman presented our Dockder Tooling experiences.
This year, we built the technology stack for a fictional company named BikeSharing360, which allows users to rent bikes from one location to another.
BikeSharing360 is a fictitious example of a smart bike sharing system with 10,000 bikes distributed in 650 stations located throughout New York City and Seattle. Their vision is to provide a modern and personalized experience to riders and to run their business with intelligence.
In this demo scenario, we built several apps for both the enterprise and the consumer (bike riders). You can find all other BikeSharing360 repos in the following locations:
- Mobile Apps
- Backend Services
- Single Container Apps
- Multi Container Apps
- Cognitive Services Kiosk App
- Azure Bot App
Bikesharing360 Single Container App
In this repo you will find the Single Container demo where Scott opened an existing project, added docker support and published it to Azure App service, running Linux Docker containers.
The Single Container demo encompasses taking an existing ASP.NET Core Web App and deploying it to Azure App Services for Linux, using container deployments. To run this demo you'll need:
- An Azure Subscription (see below)
- Visual Studio 2017 RC Choose the ".NET Core & Docker (Preview)" Workload
- Docker for Windows Used to run Docker Containers Locally, including the Linux containers used in this demo.
The creation and publishing to an Azure App Service will be done as part of the demo.
How to sign up for Microsoft Azure
To run this demo, you'll need an Azure account. You can:
- Open an Azure account for free Azure subscription. You get credits that can be used to try out paid Azure services. Even after the credits are used up, you can keep the account and use free Azure services and features, such as the Web Apps feature in Azure App Service.
- Activate Visual Studio subscriber benefits. Your Visual Studio subscription gives you credits every month that you can use for paid Azure services.
- Not a Visual Studio subscriber? Get a $25 monthly Azure credit by joining Visual Studio Dev Essentials.
Open and run the project within a container, making live changes
- Clone the before docker branch and open this repo locally using Visual Studio 2017
- Right Click the project and choose Add -> Docker Support
- F5 - or click the |> Start Debugging, with Docker as the target
- Open Views\Home\Index.cshtml
- Add some text, such as "Come see what we've got" to the end of "...throughout New York City and Seattle."
- Save Index.cshtml
- Refresh the page in the browser
- Voila, you've now run a .NET Core app in a Linux container and made a change without having to rebuild or re-run the container image.
Publish to Azure App Services
- Right Click on the project and choose Publish
- Create a new profile
- Choose [Azure App Service Linux (Preview)]
- Choose an Azure Subscription you have create rights within
- Create a new Resource Group
- Name the resource group Marketing_WestUS
- Create a new App Service Plan
- Set the Location to West US.
- Optionally choose S2 for faster deployments
- Create a new Azure Container Registry
- Set a DNS Prefix
- Set the Location to West US.
- Click [Create]. This will take a bit of time as the new resource group, registry and Azure App Services are created
- Click [Publish]
- VS will now build the project, push the image the Azure Container Registry and configure Azure App Service to pull the image. Once complete, the browser will launch with your container running in Azure App Service
Here's links to blog posts related to this project:
- Xamarin Blog: Microsoft Connect(); 2016 Recap
- The Visual Studio Blog: Announcing the new Visual Studio for Mac
- The Visual Studio Blog: Introducing Visual Studio Mobile Center (Preview)
- The Visual Studio Blog: Visual Studio 2017 Release Candidate
Copyright and license
- Code and documentation copyright 2016 Microsoft Corp. Code released under the MIT license.