Skip to content

Anshcc01/Devops-ci-cd-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Spring Boot App Deployment using Azure Container Instances & Azure DevOps

This project demonstrates how to containerize a Spring Boot application and deploy it to Azure Container Instances (ACI) using Azure DevOps CI/CD pipelines.


📦 Tech Stack

  • Java 17 + Spring Boot
  • Maven
  • Docker
  • Azure Container Registry (ACR)
  • Azure Container Instances (ACI)
  • Azure DevOps Pipelines

✅ Features

  • Containerized a Spring Boot app using Docker
  • Continuous Integration with Maven + Docker image build
  • Continuous Deployment to Azure Container Instance
  • Environment-agnostic and scalable pipeline
  • Health check support (optional)

🛠️ Prerequisites

Before you begin, ensure you have:


📁 Project Structure

springboot-azure-deploy/
├── src/                    # Spring Boot source files
├── target/                 # Maven build output
├── Dockerfile              # Container configuration
├── pom.xml                 # Project dependencies & build settings
├── azure-pipelines.yml     # CI pipeline (Build + Push)
├── aci-deploy.yml          # CD pipeline (Deploy to ACI)
└── README.md

🚧 Setup & Deployment

1. Clone this Repository

git clone https://dev.azure.com/<org>/<project>/_git/<repo>
cd <repo>

2. Build the JAR

./mvnw clean package

3. Dockerfile (Already Included)

FROM openjdk:17-jdk-alpine
VOLUME /tmp
COPY target/demo-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]

4. Create Azure Resources

az acr create --resource-group <ResourceGroup> --name <ACRName> --sku Basic

ACI will be created automatically via pipeline.


🔁 Azure DevOps Pipelines

🔹 CI Pipeline – azure-pipelines.yml

  • Packages JAR with Maven
  • Builds and pushes Docker image to ACR

🔹 CD Pipeline – aci-deploy.yml

  • Deploys image to Azure Container Instance
  • Exposes the app via a public DNS

Don't forget to create a Service Connection to Azure in DevOps.


🔐 Secrets Required

Set these as pipeline variables or secret variables group:

  • ACR_USERNAME
  • ACR_PASSWORD

🌐 Access the App

Once deployed, access it via:

http://<dns-name>.<region>.azurecontainer.io:8080/

Expected Output:

Hello, Azure!

🧪 Optional: Health Check Step

You can add this after deployment in pipeline:

- script: |
    curl http://<your-container-dns>:8080/actuator/health
  displayName: 'Health Check'

📊 Monitoring & Logs

  • View logs in Azure Portal → Container Instances → Logs
  • Use Application Insights for advanced monitoring (optional)

📄 License

This project is licensed under the MIT License. Feel free to use and modify.


🙌 Acknowledgements

Thanks to Microsoft Azure & Azure DevOps for providing free-tier cloud and CI/CD tools.


About

CSI 26

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages