-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
35 lines (32 loc) · 877 Bytes
/
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
node {
def app
def mavendocker
stage('Clone repository') {
/* Let's make sure we have the repository cloned to our workspace */
checkout scm
}
stage('Prerequisite') {
mavendocker =docker.image('maven:3.3.3')
sh 'echo "maven ready"'
}
stage('Build') {
/* This builds the actual image; synonymous to
* docker build on the command line */
mavendocker.inside {
sh 'mvn install -DskipTests'
}
app = docker.build("realtime-statistic")
}
stage('Test') {
mavendocker.inside {
sh 'mvn test'
}
junit 'target/surefire-reports/*.xml'
}
stage('Publish to Dockerhub'){
docker.withRegistry('https://registry.hub.docker.com', 'Dockerhub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
}