mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-02-11 00:51:11 +00:00
dockerfile and jenkinsfile has been added
This commit is contained in:
parent
a4fcf04c93
commit
80816bd6b8
2 changed files with 52 additions and 0 deletions
5
Dockerfile
Normal file
5
Dockerfile
Normal 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
47
Jenkinsfile
vendored
Normal 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
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue