-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
90 lines (77 loc) · 2.54 KB
/
build.gradle.kts
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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
application
java
kotlin("jvm") version "1.3.31"
id("com.google.cloud.tools.jib") version "2.3.0"
}
group = "dev.peterevans"
version = "0.1"
val buildNumber by extra("0")
repositories {
mavenCentral()
jcenter()
}
dependencies {
val kotlinVersion = "1.3.+"
implementation(kotlin("stdlib-jdk8", kotlinVersion))
val ktorVersion = "1.2.+"
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-netty:$ktorVersion")
testImplementation("io.ktor:ktor-server-test-host:$ktorVersion")
implementation("org.slf4j:slf4j-api:1.7.+")
implementation("ch.qos.logback:logback-classic:1.2.+")
val junitVersion = "5.3.+"
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation(kotlin("test-junit5", kotlinVersion))
}
dependencyLocking {
lockAllConfigurations()
}
application {
mainClassName = "dev.peterevans.webservice.ServerKt"
}
jib {
to {
image = "peterevans/webservice"
tags = setOf("$version", "$version.${extra["buildNumber"]}")
auth {
username = System.getenv("DOCKERHUB_USERNAME")
password = System.getenv("DOCKERHUB_PASSWORD")
}
}
container {
labels = mapOf(
"maintainer" to "Peter Evans <mail@peterevans.dev>",
"org.opencontainers.image.title" to "webservice",
"org.opencontainers.image.description" to "An example webservice",
"org.opencontainers.image.version" to "$version",
"org.opencontainers.image.authors" to "Peter Evans <mail@peterevans.dev>",
"org.opencontainers.image.url" to "https://github.com/peter-evans/kotlin-ktor-jib",
"org.opencontainers.image.vendor" to "https://peterevans.dev",
"org.opencontainers.image.licenses" to "MIT"
)
jvmFlags = listOf(
"-server",
"-Djava.awt.headless=true",
"-XX:InitialRAMFraction=2",
"-XX:MinRAMFraction=2",
"-XX:MaxRAMFraction=2",
"-XX:+UseG1GC",
"-XX:MaxGCPauseMillis=100",
"-XX:+UseStringDeduplication"
)
workingDirectory = "/webservice"
ports = listOf("8080")
}
}
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
"test"(Test::class) {
useJUnitPlatform()
}
named<JavaExec>("run")
}