dockerfile and jenkinsfile has been added

This commit is contained in:
Guru911 2026-02-10 13:32:09 +00:00
parent a4fcf04c93
commit 80816bd6b8
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/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
'''
}
}
}
}