From 80816bd6b8685257d088ac2e228fc52a0c0afc65 Mon Sep 17 00:00:00 2001 From: Guru911 Date: Tue, 10 Feb 2026 13:32:09 +0000 Subject: [PATCH 1/2] dockerfile and jenkinsfile has been added --- Dockerfile | 5 +++++ Jenkinsfile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..16a20e6fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM openjdk:17-jdk-slim +WORKDIR /app +COPY target/*.jar app.jar +EXPOSE 8080 +ENTRYPOINT ["java","-jar","app.jar"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..91c854f17 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,47 @@ +pipeline { + agent any + + stages { + + stage('Checkout') { + steps { + git 'https://github.com/spring-projects/spring-petclinic.git' + } + } + + stage('Build') { + steps { + sh 'mvn clean package -DskipTests' + } + } + + stage('Test') { + steps { + sh 'mvn test' + } + } + + stage('SonarQube Analysis') { + steps { + withSonarQubeEnv('sonarqube') { + sh 'mvn sonar:sonar' + } + } + } + + stage('Docker Build') { + steps { + sh 'docker build -t petclinic:1.0 .' + } + } + + stage('Run Application') { + steps { + sh ''' + docker rm -f petclinic || true + docker run -d -p 8081:8080 --name petclinic petclinic:1.0 + ''' + } + } + } +} From 24b4f9004657a4f7a51b9eca0ca41f8a893be27c Mon Sep 17 00:00:00 2001 From: Gurudatha D <131242246+Guru911@users.noreply.github.com> Date: Tue, 10 Feb 2026 20:03:02 +0530 Subject: [PATCH 2/2] Update Jenkinsfile chaged the fork git repo Signed-off-by: Gurudatha D <131242246+Guru911@users.noreply.github.com> --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 91c854f17..12d91e03e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { stage('Checkout') { steps { - git 'https://github.com/spring-projects/spring-petclinic.git' + git 'https://github.com/Guru911/spring-petclinic.git' } }