Automatically deploy your containerized app to Azure App Service with Jenkins CI-CD Pipeline using GitHub Webhook - Part 4

ferozekhanferozekhan
3 min read

In the previous tutorial Part 3 of the series, you have already learned to dockerize a sample NodeJS application and deploy the same to Azure Web App, by manually running the Jenkins Pipeline Build. This is a follow up tutorial on how to configure Jenkins to automatically Build, Push and Deploy the containerized application as part of the CI-CD Jenkins pipeline job

Here are quick steps that we shall follow:

  • Create a Jenkins VM Create a Jenkins Linux VM Part 1

  • Install Docker Engine on the Azure VM that is running Jenkins Install Docker on a Linux VM Part 2

  • Run the Build manually to Deploy the new image build to your Azure Web App Deploy Web App Part 3

  • Prepare your GitHub repository with the App Code

  • Create the new Automated CI-CD Jenkins pipeline to automatically execute the Build and Deploy tasks

  • Run the pipeline and verify the Web App is updated with the latest image build

Prerequisites

  • Azure subscription: If you don't have an Azure subscription, create a free account before you begin.

  • Jenkins - Install Jenkins on a Linux VM

  • Azure CLI: Install Azure CLI (version 2.0.67 or higher) on the Jenkins server.

  • Sample Application Code can be found at my Github Repository HERE

Create your Fully Automated CI-CD Jenkins Pipeline

Docker Build, Push and Run

Create a new GitHub repository with your application code. We will need to create a webhook for the GitHub repository that should be able to remotely trigger your builds jobs in Jenkins everytime application changes are commited and pushed to the above application code repository.

image

We will define the Jenkins Pipeline with the Peipeline script from SCM method as shown below

image

image

image

This should now allow the GitHub repository webhook to remote trigger the Build Jobs for the above pipeline in Jenkins, whenever you commit changes to your application code repository.

Commit your application code changes and push the Application code repository on GitHub

The GitHub webhook should now trigger the Jenkins Pipeline Job and the Build Job should run automatically.

image

Wait until the Jenkins Pipeline build job is over. A graphic below the Build History heading indicates that the job is being executed or completed. Go to the job build and console output to see the results.

image

Congratulations! You have successfully Deployed your containerized app to your Azure Web App. Your Azure Web App should now be running your newly generated docker image with your App Code

image

Testing your Web App that should now be running your newly generated docker image with your App Code

Below is Application v98 running as your Web App (your build version differ)

image

Commit and push your changes to your application code on GitHub and the GitHub webhook should trigger the Jenkins Pipeline Build automatically. The Jenkins Pipeline will automatically Build, Push and Deploy your containerized Application to the Azure Web App as part of your complete CI-CD Job. The Application should now be running a new Build as your Web App (your build version differ)

image

Next steps

Create your Fully Automated CI-CD Jenkins Pipeline to Deploy your Application to an AKS Cluster - Part 5 HERE

1
Subscribe to my newsletter

Read articles from ferozekhan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

ferozekhan
ferozekhan