Let's use NUKE to Quickly Deploy an App to Azure via Zip Deployment

Georg Dangl by Georg Dangl in Continuous Integration Monday, October 12, 2020

Monday, October 12, 2020

Posted in Jenkins

It's no secret I'm a big fan of the NUKE build system, it's making my life just so much more convenient! So here's a small real world example that demonstrates how easy it is to deploy a static website to an Azure App Service using NUKE and Kudu Zip Deployment. You can check out the repository here if you want to see it all.

Recently, I was going through some old repositories on my GitHub account for the occasional cleaning - just checking if something needs an update, or is no longer working. My antlr-calculator project hadn't been updated in a while, and the demo site was still hosted on a virtual server. So, a great task to kill an evening was found! I decided to update the build system from just some CLI commands to use NUKE and to additional move the hosting to an Azure App Service.

Many think that for using NUKE to automate your build, you need a .NET project. But while NUKE leverages C# to set up your build, you can actually use it to automate any task you want. For example, here's how you build an NPM package:

Or, in this case, build & deploy a static website to Azure. Let's go through this step by step. First, we define the Target DeployDemo in Nuke. It's set up to invoke the Clean target and specifies some required parameters:

Next, we use NPM to build the site and update a placeholder in index.html for the version:

Then we get the Base64 encoded authentication header value to deploy to Azure and zip the output into a Zip file:

Finally, we POST this zip file to the Kudu API and wait for a response:

That's it! Now you've deployed a small websites to Azure. With build automation servers, like Jenkins, GitHub Actions or Azure Pipelines, you can configure your build scripts to run on every commit.

Happy automating!

Share this post

comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.


Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

// Just 💗 Coding

Social Links