-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
113 lines (98 loc) · 3.94 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import io.ktor.plugin.features.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import io.ktor.plugin.features.JreVersion.JRE_11
val ktorVersion: String by project
val kotlinVersion: String by project
val logbackVersion: String by project
val prometheusVersion: String by project
val koinVersion: String by project
val koinKtor: String by project
val mockkVersion: String by project
val appVersion: String by project
val detektVersion: String by project
val dockerImageName: String by project
group = "io.github.sanctumlabs"
version = appVersion
plugins {
application
kotlin("jvm") version "2.0.21"
id("io.ktor.plugin") version "3.0.1"
id("org.jetbrains.kotlin.plugin.serialization") version "2.0.21"
id("io.gitlab.arturbosch.detekt") version "1.23.7"
}
repositories {
mavenCentral()
}
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_11
}
tasks {
withType<JavaCompile> {
sourceCompatibility = "${JavaVersion.VERSION_11}"
targetCompatibility = "${JavaVersion.VERSION_11}"
}
withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "${JavaVersion.VERSION_11}"
}
}
}
detekt {
toolVersion = detektVersion
source = files("src/main/kotlin", "src/test/kotlin")
}
application {
mainClass.set("io.ktor.server.netty.EngineMain")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
ktor {
docker {
jreVersion.set(JRE_11)
localImageName.set(dockerImageName)
imageTag.set(appVersion)
portMappings.set(
listOf(
DockerPortMapping(outsideDocker = 8080, insideDocker = 8080, protocol = DockerPortMappingProtocol.TCP)
)
)
externalRegistry.set(
DockerImageRegistry.dockerHub(
appName = provider { dockerImageName },
username = providers.environmentVariable("DOCKER_USERNAME"),
password = providers.environmentVariable("DOCKER_PASSWORD")
),
)
// for Google Container Registry
// externalRegistry.set(
// DockerImageRegistry.googleContainerRegistry(
// appName = provider { dockerImageName },
// projectName = providers.environmentVariable("GOOGLE_PROJECT_NAME"),
// username = providers.environmentVariable("GOOGLE_CONTAINER_REGISTRY_USERNAME"),
// password = providers.environmentVariable("GOOGLE_CONTAINER_REGISTRY_PASSWORD")
// )
// )
}
}
dependencies {
implementation("io.ktor:ktor-server-call-logging-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-call-id-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-core-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-metrics-micrometer-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-metrics-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-content-negotiation-jvm:$ktorVersion")
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm:$ktorVersion")
implementation("io.ktor:ktor-server-netty-jvm:$ktorVersion")
implementation("io.insert-koin:koin-core:$koinVersion")
implementation("io.insert-koin:koin-ktor:$koinKtor")
implementation("io.insert-koin:koin-logger-slf4j:$koinKtor")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
implementation("io.micrometer:micrometer-registry-prometheus:$prometheusVersion")
testImplementation("io.insert-koin:koin-test:$koinVersion")
testImplementation("io.insert-koin:koin-test-junit4:$koinVersion")
testImplementation("io.insert-koin:koin-test-junit5:$koinVersion")
testImplementation("io.ktor:ktor-server-tests-jvm:$ktorVersion")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
testImplementation("io.mockk:mockk:$mockkVersion")
}