forked from spring-projects/spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
35 lines (34 loc) · 1 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pipeline {
agent any
stages {
stage('Build') {
agent {
docker {
image 'maven:3-alpine'
args '-v $HOME/.m2:/root/.m2'
}
}
steps {
echo 'Building..'
sh 'mvn clean package'
stash includes: 'target/*', name: 'app'
}
}
stage('Build image') {
agent any
steps {
unstash 'app'
sh 'docker build -t victoriakuanysheva/petclinic:${BUILD_NUMBER} .'
sh 'docker tag victoriakuanysheva/petclinic:${BUILD_NUMBER} victoriakuanysheva/petclinic:latest'
}
}
stage('CD') {
agent any
steps {
withDockerRegistry([ credentialsId: "docker-hub", url: "https://index.docker.io/v1/" ]) {
sh 'docker push victoriakuanysheva/petclinic:latest'
}
}
}
}
}