Let’s dockerize our web app! We will be performing all operations using the Azure CLI, and all of our work will be built using Visual Studio Code on Bash On Windows, Linux, Mac OS. If you have not already, make sure you have a .NET Core Web App ready to go.
- [Required] Azure CLI (install guide).
- [Required] .NET Core (CLI 1.0.0-rc4-004800+).
- [Required] Azure Subscription.
- [Required] git.
- [Required] Docker.
NOTE: all command statements with multiple lines ignore the need for a newline escape.
First, we need a dockerfile. Minimally, we need a docker file that looks like this.
Next, let’s create a docker image of our web app.
If you would like, you can check that your image was built properly.
We can verify that our site is working by navigating to http://localhost/api/name/Aaron (or any endpoint in your app).
Let’s pubish our image to docker hub (though, you can use any container registry).
First, we need to do some setup if you have not already done so (some of these steps may have been completed before, but we need an
Finally, we need to configure our web app to run of our docker image.
You can use whatever method you prefer to test your new web app interaction with DocumentDB. In my case, I am using
curl with Bash On Windows.
Get from an endpoint.
That’s it! In about 10 minutes, we have dockerized our web app and deployed it to Azure!