-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
116 lines (94 loc) · 2.9 KB
/
build.gradle
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import com.bmuschko.gradle.docker.tasks.image.*
import java.util.regex.Matcher
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
plugins {
id 'java'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'com.bmuschko.docker-remote-api' version '4.8.0'
id 'net.researchgate.release' version '2.6.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.1.3.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-parent', version: '2.1.3.RELEASE'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
docker {
registryCredentials {
url = 'https://cloud.docker.com/repository/docker/devnxt/bob'
username = 'devnxt'
password = "$System.env.DOCKER_CRD"
email = 'my007id@gmail.com'
}
}
task copyFiles(type: Copy) {
dependsOn bootJar
from(tasks.bootJar.outputs.files.singleFile)
into("build/docker")
}
task createDockerfile(type: Dockerfile) {
dependsOn copyFiles
from('openjdk:jre-alpine')
copyFile('bob-' + version + '.jar', '/app/bob' + version + '.jar')
entryPoint('java')
defaultCommand('-jar', '/app/bob' + version + '.jar')
exposePort(8080)
}
task buildImage(type: DockerBuildImage) {
dependsOn createDockerfile
tags.add('devnxt/bob:' + project.version)
}
task pushImage(type: DockerPushImage) {
dependsOn buildImage
imageName = 'devnxt/bob'
tag = project.version
}
task deleteImage(type: DockerRemoveImage) {
shouldRunAfter pushImage
force = true
imageId = 'devnxt/bob:' + project.version
}
release {
failOnCommitNeeded = true
failOnPublishNeeded = true
failOnSnapshotDependencies = true
failOnUnversionedFiles = true
failOnUpdateNeeded = true
revertOnFail = true
preCommitText = '[Gradle Release Plugin] - preparing to release'
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
tagTemplate = '${version}'
versionPropertyFile = 'gradle.properties'
versionProperties = []
buildTasks = ['build']
versionPatterns = [
/(\d+)([^\d]*$)/: { Matcher m, Project p -> m.replaceAll("${(m[0][1] as int) + 1}${m[0][2]}") }
]
scmAdapters = [
net.researchgate.release.GitAdapter,
net.researchgate.release.SvnAdapter,
net.researchgate.release.HgAdapter,
net.researchgate.release.BzrAdapter
]
git {
requireBranch = 'master'
pushToRemote = 'origin'
pushToBranchPrefix = ''
commitVersionFileOnly = false
signTag = false
}
}
afterReleaseBuild.dependsOn pushImage