DevOps has evolved today to include Continuous integration and continuous delivery (CI/CD), along with programmable infrastructure and services that support automating the entire lifecycle of an application.
In this article, I provide a simple example to understand how to use Azure DevOps Services to build, test and deploy a Java based application inside a Docker container. The steps provided in this blog article should help you understand the sequence of building a fully automated build and release pipeline for a sample Java application that is designed to be built using Maven.
Pre-requisites:
- You should know how to create a git repo
- You should be aware how maven works to be able to troubleshoot the build itself
- You should be aware of YAML syntax
- You should have a local copy of a sample Java console application along with the POM file, structured as a Maven project.
Steps:
- Sign in to GitHub.
- Create a Repository.
- Using the command line, push your java project to the github repository.
- Sign in to Azure DevOps at dev.azure.com and create a new organization.
- Create a new Project in this organization.
- Click on the Project.
- Navigate to the Repos -> Files Option and select ‘Import’.
- Provide the URL to the github repo you created in step 2.
- Verify that the code is properly pulled into the Azure git repo for this project.
- Clone this repo onto your development machine.
- Add the azure-pipeline-1.yml file to the project containing the build sequence that should get executed on Azure DevOps.
- Add the Dockerfile that will be used to create the docker container for hosting the java application.
- Commit the artifacts to the Azure DevOps git repo.
- From the Pipelines menu in Azure DevOps, add a new pipeline pointing to the file you created in step 11.
- Observe how the pipeline runs and verify the output from the log.
