-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
123 lines (99 loc) · 4.57 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
114
115
116
117
118
119
120
121
122
123
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
val group: String by project
val version: String by project
java.sourceCompatibility = JavaVersion.VERSION_21
val dockerRegistry = "goafabric"
val nativeBuilder = "paketobuildpacks/java-native-image:9.5.0"
val baseImage = "ibm-semeru-runtimes:open-21.0.3_9-jre-focal@sha256:5cb19afa9ee0daeecb7c31be8253fecbbf6b5f6dcfb06883c41f045cb893bcec"
plugins {
java
jacoco
id("org.springframework.boot") version "3.3.3"
id("io.spring.dependency-management") version "1.1.6"
id("org.graalvm.buildtools.native") version "0.10.2"
id("com.google.cloud.tools.jib") version "3.4.3"
id("net.researchgate.release") version "3.0.2"
id("org.sonarqube") version "5.0.0.4638"
id("org.cyclonedx.bom") version "1.8.2"
}
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/milestone") }
maven { url = uri("https://repo.spring.io/snapshot") }
}
dependencies {
constraints {
annotationProcessor("org.mapstruct:mapstruct-processor:1.5.5.Final")
implementation("org.mapstruct:mapstruct:1.5.5.Final")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0")
implementation("io.github.resilience4j:resilience4j-spring-boot3:2.1.0")
implementation("net.ttddyy.observation:datasource-micrometer-spring-boot:1.0.3")
}
}
dependencies {
//web
implementation("org.springframework.boot:spring-boot-starter-web")
//security
implementation("org.springframework.boot:spring-boot-starter-security")
//monitoring
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("io.micrometer:micrometer-registry-prometheus")
implementation("io.micrometer:micrometer-tracing-bridge-otel")
implementation("io.opentelemetry:opentelemetry-exporter-otlp")
implementation("net.ttddyy.observation:datasource-micrometer-spring-boot")
//openapi
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui")
//crosscuting
implementation("org.springframework.boot:spring-boot-starter-aop")
//code generation
implementation("org.mapstruct:mapstruct")
annotationProcessor("org.mapstruct:mapstruct-processor")
implementation("net.datafaker:datafaker:1.8.1") { exclude("org.yaml", "snakeyaml") }
//persistence
implementation("org.springframework.boot:spring-boot-starter-data-jpa") {exclude("org.glassfish.jaxb", "jaxb-runtime")}
implementation("com.h2database:h2")
implementation("org.postgresql:postgresql")
implementation("org.flywaydb:flyway-core")
implementation("org.flywaydb:flyway-database-postgresql")
//kafka
implementation("org.springframework.kafka:spring-kafka")
//elastic
implementation("org.springframework.boot:spring-boot-starter-data-elasticsearch")
//s3
implementation("am.ik.s3:simple-s3-client:0.2.1") {exclude("org.springframework", "spring-web")}
//devtools
developmentOnly("org.springframework.boot:spring-boot-devtools")
//test
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("ca.uhn.hapi.fhir:hapi-fhir-client-okhttp:6.8.3")
testImplementation("ca.uhn.hapi.fhir:hapi-fhir-structures-r4:6.8.3")
}
tasks.withType<Test> {
useJUnitPlatform()
exclude("**/*NRIT*")
finalizedBy("jacocoTestReport")
}
tasks.jacocoTestReport { reports {csv.required.set(true); xml.required.set(true) } }
jib {
val amd64 = com.google.cloud.tools.jib.gradle.PlatformParameters(); amd64.os = "linux"; amd64.architecture = "amd64"; val arm64 = com.google.cloud.tools.jib.gradle.PlatformParameters(); arm64.os = "linux"; arm64.architecture = "arm64"
from.image = baseImage
to.image = "${dockerRegistry}/${project.name}:${project.version}"
container.jvmFlags = listOf("-Xms256m", "-Xmx256m")
from.platforms.set(listOf(amd64, arm64))
}
tasks.register("dockerImageNative") { group = "build"; dependsOn("bootBuildImage") }
tasks.named<BootBuildImage>("bootBuildImage") {
val nativeImageName = "${dockerRegistry}/${project.name}-native" + (if (System.getProperty("os.arch").equals("aarch64")) "-arm64v8" else "") + ":${project.version}"
builder.set("paketobuildpacks/builder-jammy-buildpackless-tiny")
buildpacks.add(nativeBuilder)
imageName.set(nativeImageName)
environment.set(mapOf("BP_NATIVE_IMAGE" to "true", "BP_JVM_VERSION" to "21", "BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "-J-Xmx6000m -march=compatibility"))
doLast {
exec { commandLine("/bin/sh", "-c", "docker run --rm $nativeImageName -check-integrity") }
exec { commandLine("/bin/sh", "-c", "docker push $nativeImageName") }
}
}
configure<net.researchgate.release.ReleaseExtension> {
buildTasks.set(listOf("build", "test", "jib", "dockerImageNative"))
tagTemplate.set("v${version}".replace("-SNAPSHOT", ""))
}