forked from SUIN-BUNDANG-LINE/Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
173 lines (148 loc) · 5.33 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
fun getCurrentDateTime(): String = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmm"))
plugins {
id("org.springframework.boot") version "3.3.1"
id("io.spring.dependency-management") version "1.1.5"
// kotlin("plugin.jpa") version "1.9.24"
kotlin("jvm") version "1.9.24"
kotlin("plugin.spring") version "1.9.24"
id("org.jlleitschuh.gradle.ktlint") version "12.1.1"
id("com.google.cloud.tools.jib") version "3.4.0"
jacoco
}
group = "com.sbl"
version = "0.0.1-SNAPSHOT"
java {
sourceCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.springframework.boot:spring-boot-starter-actuator")
// fingerprint
// implementation("com.github.fingerprintjs:fingerprint-pro-server-api-java-sdk:v6.0.0")
// security
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
// JWT
implementation("io.jsonwebtoken:jjwt-api:0.12.6")
implementation("io.jsonwebtoken:jjwt-impl:0.12.6")
implementation("io.jsonwebtoken:jjwt-jackson:0.12.6")
// jpa (RDBMS 사용 전 까지는 비활성화)
// implementation("org.springframework.boot:spring-boot-starter-data-jpa")
// mysql (MySQL 사용 전 까지는 비활성화)
// runtimeOnly("com.mysql:mysql-connector-j")
// mongoDB
implementation("org.springframework.boot:spring-boot-starter-data-mongodb")
// mongock
implementation("io.mongock:mongock-springboot:5.4.4")
implementation("io.mongock:mongodb-springdata-v4-driver:5.4.4")
// validation
implementation("org.springframework.boot:spring-boot-starter-validation")
// Swagger
implementation("org.springdoc:springdoc-openapi:2.3.0")
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0")
// AWS
implementation("software.amazon.awssdk:bom:2.27.24")
implementation("software.amazon.awssdk:s3:2.27.24")
// test
testImplementation("org.mockito:mockito-core:4.0.0")
testImplementation("org.mockito:mockito-inline:4.0.0")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.0.0")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// New Relic
implementation("com.newrelic.agent.java:newrelic-agent:8.13.0")
// Redis
implementation("org.springframework.boot:spring-boot-starter-data-redis")
}
kotlin {
compilerOptions {
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = JavaVersion.VERSION_17.toString()
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.test {
useJUnitPlatform()
finalizedBy(tasks.jacocoTestReport)
}
tasks.jacocoTestReport {
reports {
html.required.set(true)
xml.required.set(true)
csv.required.set(false)
}
}
jib {
from {
image = "openjdk:17-slim"
auth {
username = project.findProperty("DOCKER_ID") as String?
password = project.findProperty("DOCKER_PASSWORD") as String?
}
}
to {
image = "${project.findProperty("DOCKER_ID")}/${project.findProperty("DOCKER_IMAGE_NAME")}"
auth {
username = project.findProperty("DOCKER_ID") as String?
password = project.findProperty("DOCKER_PASSWORD") as String?
}
tags =
// 운영 배포면 현재 버전에 대한 태그를 붙힌다., 개발 배포면 devLatest와 YYMMDDhhmm 태그를 붙인다.
let {
val versionName = project.findProperty("VERSION") as String?
if (versionName != null) {
setOf(versionName)
} else {
setOf(getCurrentDateTime(), "devLatest")
}
}
}
container {
// JVM 메모리 설정
jvmFlags =
listOf(
"-Xms${project.findProperty("JVM_XMS")}",
"-Xmx${project.findProperty("JVM_XMX")}",
)
// New Relic 설정
val newRelicConfig = project.file("newrelic/newrelic.yml")
val newRelicJar = project.file("newrelic/newrelic.jar")
if (newRelicConfig.exists() && newRelicJar.exists()) {
jvmFlags =
listOf(
"-Xms${project.findProperty("JVM_XMS")}",
"-Xmx${project.findProperty("JVM_XMX")}",
"-Dnewrelic.config.file=/app/config/newrelic.yml",
"-javaagent:/app/config/newrelic.jar",
)
}
}
// New Relic 설정
extraDirectories {
paths {
path {
setFrom(file("newrelic").toPath())
into = "/app/config"
}
}
}
}