This commit is contained in:
Gurudatha D 2026-02-10 14:33:45 +00:00 committed by GitHub
commit 21dd3c812c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 52 additions and 0 deletions

5
Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","app.jar"]

47
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,47 @@
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git 'https://github.com/Guru911/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
'''
}
}
}
}