-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
93 lines (77 loc) · 2.46 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
buildscript {
ext {
kotlinVersion = '1.2.20'
springBootVersion = '2.0.0.RELEASE'
}
repositories {
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath('com.bmuschko:gradle-docker-plugin:3.2.4')
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.bmuschko.docker-remote-api'
group = 'com.r2m.kotlin'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
}
dependencies {
dockerJava 'org.slf4j:slf4j-simple:1.7.5'
dockerJava 'cglib:cglib:3.2.0'
dockerJava('com.github.docker-java:docker-java:3.1.0-rc-3')
compile('org.springframework.boot:spring-boot-starter-webflux')
compile('com.fasterxml.jackson.module:jackson-module-kotlin')
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('io.projectreactor:reactor-test')
}
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
def privateRepo = '192.168.99.107:8083'
docker {
registryCredentials {
url = 'http//:' + privateRepo
username = 'admin'
password = 'admin123'
}
}
task createDockerfile(type: Dockerfile) {
destFile = file('/var/jenkins_home/workspace/app-ci/build/libs/Dockerfile')
from 'openjdk:8-jdk-slim'
copyFile('app-ci-0.0.1-SNAPSHOT.jar', '/opt')
exposePort 8080
entryPoint('/usr/bin/java')
defaultCommand('-jar', '/opt/app-ci-0.0.1-SNAPSHOT.jar')
}
task createDockerImage(type: DockerBuildImage) {
inputDir = file('/var/jenkins_home/workspace/app-ci/build/libs/')
tags = [privateRepo + '/demoapp']
}
task pushDockerImage(type: DockerPushImage) {
imageName = privateRepo + '/demoapp'
}
docker {}