-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
42 lines (40 loc) · 1.02 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
36
37
38
39
40
41
42
pipeline {
agent any
tools {
jdk 'java11'
}
stages {
stage('Clean') {
steps {
sh "./gradlew --no-daemon clean"
}
}
stage('Test') {
steps {
sh './gradlew test'
}
}
stage('Clean All Containers') {
steps {
script{
def doc_containers = sh(returnStdout: true, script: 'docker container ps -aq').replaceAll("\n", " ")
if (doc_containers) {
sh "docker stop ${doc_containers}"
}
}
sh 'docker system prune --all --force --volumes'
}
}
stage('Deploy container') {
steps {
sh './gradlew --no-daemon assemble docker dockerRun'
}
}
stage('Check running image') {
steps {
sh 'docker images'
sh 'docker ps'
}
}
}
}