forked from OpenRiskNet/example-java-servlet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
37 lines (37 loc) · 879 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
36
37
pipeline {
agent any
stages {
stage('Build') {
steps {
sh './gradlew clean war'
archiveArtifacts artifacts: 'build/libs/*.war', fingerprint: false
}
}
stage('Test') {
steps {
sh './gradlew test'
}
post {
always {
junit 'build/test-results/**/*.xml'
archiveArtifacts artifacts: 'build/reports/**/*.*'
}
}
}
stage('Docker build image') {
steps {
sh '''./gradlew buildDockerfile && \
docker build -t openrisknet/example-java-servlet build'''
}
}
stage('Docker push image') {
environment {
DOCKER_CREDENTIALS = credentials('DOCKER_HUB_PUSH')
}
steps {
sh 'docker login -u $DOCKER_CREDENTIALS_USR -p $DOCKER_CREDENTIALS_PSW'
sh 'docker push openrisknet/example-java-servlet'
}
}
}
}