mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-27 09:25:49 +00:00
new aproach
This commit is contained in:
parent
d9beccecb0
commit
5c5ea6e1fa
2 changed files with 17 additions and 32 deletions
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
|
@ -2,48 +2,33 @@ pipeline {
|
|||
|
||||
agent any
|
||||
|
||||
environment {
|
||||
BUILD_CONTAINER_ID = ''
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Build') {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename 'Dockerfile.build'
|
||||
dir '.'
|
||||
additionalBuildArgs '-t petclinic-build'
|
||||
args '-v $HOME/.m2:/root/.m2'
|
||||
}
|
||||
args '$HOME/.m2:/root/.m2'
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
echo 'Done'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Copy .jar file') {
|
||||
agent {
|
||||
docker {
|
||||
image 'docker:dind'
|
||||
args '-v /var/run/docker.sock:/var/run/docker.sock --user root'
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh """docker run -d \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--name petclinic-build petclinic-build"""
|
||||
sh 'docker cp petclinic-build:/build/target/app.jar .'
|
||||
BUILD_CONTAINER_ID = "sh 'docker run -v $HOME/.m2:/root/.m2 -d petclinic-build'"
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run') {
|
||||
agent {
|
||||
dockerfile {
|
||||
filename 'Dockerfile.run'
|
||||
dir '.'
|
||||
}
|
||||
additionalBuildArgs '-t petclinic-run'
|
||||
}
|
||||
steps {
|
||||
echo 'Done'
|
||||
sh 'docker cp ${BUILD_CONTAINER_ID}:/build/target/app.jar .'
|
||||
sh 'docker-compose up'
|
||||
/* sh 'docker run -it --rm -p 8080:8080 petclinic-run' */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
services:
|
||||
app:
|
||||
image: hllvc/spring-petclinic:latest
|
||||
image: petclinic-run
|
||||
links:
|
||||
- mysql:mysql
|
||||
ports:
|
||||
|
|
Loading…
Reference in a new issue