A showcase of a CI/CD pipeline for a Java application using Jenkins, Docker, and SonarQube. This project walks through a streamlined process to build, test, and deploy a Java application using modern DevOps practices.
- Dockerfile - Contains instructions for building the application image.
- How to Install Sonarqube in Ubuntu Linux.md - Guide to set up SonarQube on Ubuntu.
- Jenkinsfile - CI/CD pipeline configuration for Jenkins.
- pom.xml - Maven configuration file.
- server/ - Contains backend service code.
- webapp/ - Contains frontend web application code.
Before running the pipeline, make sure the following tools are installed:
- Jenkins - To automate CI/CD tasks.
- Docker - Required for building and pushing Docker images.
- SonarQube - For analyzing code quality.
- Maven - Used for building the Java project.
Clone the repository to your local machine using:
git clone https://github.com/SaraIravani/Java-sample-ci.git
cd Java-sample-ci- Plugins: Install essential Jenkins plugins, including Pipeline, Docker, and SonarQube.
- Credentials:
- GitHub: Create a credential for accessing your GitHub repository.
- SonarQube: Add a token for SonarQube analysis.
- DockerHub: Set up Docker credentials for pushing images.
The Jenkinsfile defines the stages for building, testing, and deploying the application. Key pipeline stages include:
- SCM Checkout - Clones the repository.
- Build - Compiles the application using Maven.
- Test - Runs unit tests.
- SonarQube Analysis - Performs code quality analysis.
- Docker Image Build & Push - Builds and pushes the Docker image to DockerHub.
- CD Pipeline Trigger - Initiates the continuous deployment pipeline.
- Create a new pipeline job in Jenkins and point it to your Jenkinsfile.
- Run the job to execute the complete CI/CD pipeline.
Here are some useful links and resources:
- SonarQube Setup on Ubuntu - Step-by-step setup guide.
- Docker Documentation - Official Docker documentation.
- Jenkins Documentation - Official Jenkins documentation.
- SonarQube Documentation - Official SonarQube documentation.
This project is licensed under the MIT License - see the LICENSE file for details.
⭐ If you find this project helpful, please consider starring it to support further development!
Happy Building! 🎉