forked from gesellix/graceful-shutdown-spring-boot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
93 lines (80 loc) · 2.6 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
import de.gesellix.gradle.docker.tasks.DockerBuildTask
import de.gesellix.gradle.docker.tasks.DockerPushTask
import de.gesellix.gradle.docker.tasks.DockerRmiTask
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
buildscript {
ext {
dockerPluginVersion = '2017-06-07T23-32-34'
kotlinVersion = '1.1.2-2'
springBootVersion = '1.5.3.RELEASE'
}
repositories {
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
}
dependencies {
classpath("de.gesellix:gradle-docker-plugin:${dockerPluginVersion}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'org.springframework.boot'
apply plugin: "de.gesellix.docker"
version = ZonedDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH-mm-ss"))
sourceCompatibility = JavaVersion.VERSION_1_8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-web')
compile('de.gesellix:docker-client:2017-06-07T21-30-42')
compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}")
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
ext {
dockerBuildContextSources = file("${projectDir}/src/main/docker")
dockerBuildContextDir = file("${buildDir}/docker")
dockerImageName = "gesellix/graceful-spring-shutdown"
dockerImageId = "${dockerImageName}:${project.version}"
}
task prepareBuildContext(type: Copy) {
from dockerBuildContextSources
into dockerBuildContextDir
}
task copyArtifact(type: Copy) {
dependsOn bootRepackage
dependsOn prepareBuildContext
from { jar }
into dockerBuildContextDir
rename { "app.jar" }
}
task rmiLocalImage(type: DockerRmiTask) {
imageId = dockerImageId
}
task buildImage(type: DockerBuildTask) {
dependsOn copyArtifact
buildContextDirectory = dockerBuildContextDir
imageName = dockerImageId
}
task publishImage(type: DockerPushTask, dependsOn: [buildImage]) {
repositoryName = buildImage.imageName
authConfigPlain = getDockerClient().readDefaultAuthConfig()
finalizedBy rmiLocalImage
}
task wrapper(type: Wrapper) {
gradleVersion = "4.1"
distributionType = Wrapper.DistributionType.ALL
}