How dhiresh-git/java-webapp-ci-cd-project works
Project type and purpose
• From the file tree and README, this is a Java Spring Boot web application (com.example.demo) whose sole controller (WebAppController.java) serves HTTP requests.
• The primary focus of the project is on setting up an automated CI/CD pipeline: whenever code is pushed to GitHub, Jenkins picks it up, runs Maven build/tests, builds a Docker image, and deploys it to an AWS EC2 instance.
File structure
• Top‐level files:
• pom.xml – Maven build descriptor
• mvnw, mvnw.cmd, .mvn/wrapper – Maven wrapper
• Dockerfile – containerizes the Spring Boot app
• Jenkinsfile – pipeline-as-code defining build/test/deploy stages
• Source tree under src/main/java/com/example/demo:
• WebAppApplication.java – Spring Boot entry point
• WebAppController.java – REST controller
• src/main/resources/application.properties – runtime configuration
• Tests under src/test/java/... mirror the application package
README for additional insights
• Describes an automated CI/CD pipeline using Jenkins, Docker, and AWS EC2
a. Main components
• Developer Workstation / IDE
• GitHub (Code Repository + Webhook)
• Jenkins (Master + Build Agents)
• Docker Engine (on Jenkins agent)
• Container Registry (optional AWS ECR or Docker Hub)
• AWS EC2 Instance (Docker Host running the container)
• Spring Boot Application (embedded Tomcat inside container)
b. Relationships and interactions
1. Developer pushes to GitHub
2. GitHub webhook triggers Jenkins pipeline
3. Jenkins agent checks out code and runs Maven: clean package, test
4. On success, Jenkins builds Docker image from Dockerfile
5. Jenkins pushes image to a registry (or directly SSHs into EC2)
6. Jenkins (or EC2 user data) pulls the new image on AWS EC2
7. EC2 Docker Engine runs the container; the Spring Boot app listens on port 8080
c. Architectural patterns and design principles
• Pipeline-as-code (Jenkinsfile)
• Containerization (Dockerfile + 12-factor principles)
• Infrastructure as code / immutable infrastructure (spin up new containers on deploy)
d. Relevant technologies/frameworks
• Spring Boot (Java)
• Maven (build & dependency management)
• Docker (build & runtime)
• Jenkins (CI/CD orchestrator)
• AWS EC2 (target compute)