-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
40 lines (40 loc) · 934 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
38
39
40
pipeline {
agent any
tools {
jdk 'java21slave'
}
options {
buildDiscarder(logRotator(numToKeepStr: '1'))
}
parameters {
booleanParam(defaultValue: false, description: 'Publish to DockerHub', name: 'PUBLISHIMAGE')
}
environment {
LOGSTASH = 'nuc:5044'
}
stages {
stage('Git') {
steps {
git(url: 'https://github.com/wlanboy/MirrorService.git', branch: 'master')
}
}
stage('Build') {
steps {
sh 'mvn clean package'
}
}
stage('Container') {
steps {
sh 'docker build -t mirrorservice:latest . --build-arg JAR_FILE=./target/mirrorservice-0.2.1-SNAPSHOT.jar'
}
}
stage('Publish') {
when { expression { params.PUBLISHIMAGE == true } }
steps {
withDockerRegistry([ credentialsId: "dockerhub", url: "" ]) {
sh 'docker push wlanboy/mirrorservice:latest'
}
}
}
}
}