Skip to content

Commit

Permalink
feat: add jib to project
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jun 15, 2024
1 parent 5efdcba commit be06b9f
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
34 changes: 34 additions & 0 deletions api-gateway/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
java
id("org.springframework.boot") version "3.3.0"
id("io.spring.dependency-management") version "1.1.5"
id("com.google.cloud.tools.jib") version "3.4.2"
}

group = "kr.mafoo"
Expand Down Expand Up @@ -37,3 +38,36 @@ dependencyManagement {
tasks.withType<Test> {
useJUnitPlatform()
}

jib {
val activeProfile: String? = System.getenv("SPRING_PROFILES_ACTIVE")
val imageName: String? = System.getenv("IMAGE_NAME")
val imageTag: String? = System.getenv("IMAGE_TAG")
val serverPort: String = System.getenv("SERVER_PORT") ?: "8080"
from {
image = "amazoncorretto:17-alpine3.17-jdk"
}
to {
image = imageName
tags = setOf(imageTag, "latest")
}
container {
jvmFlags =
listOf(
"-Dspring.profiles.active=$activeProfile",
"-Dserver.port=$serverPort",
"-Djava.security.egd=file:/dev/./urandom",
"-Dfile.encoding=UTF-8",
"-Duser.timezone=Asia/Seoul",
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseContainerSupport",
"-XX:+UseG1GC",
"-XX:InitialHeapSize=1g",
"-XX:MaxHeapSize=1g",
"-XX:+DisableExplicitGC", // System.gc() 방어
"-server",
)
ports = listOf(serverPort)
}
}

33 changes: 33 additions & 0 deletions photo-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
java
id("org.springframework.boot") version "3.3.0"
id("io.spring.dependency-management") version "1.1.5"
id("com.google.cloud.tools.jib") version "3.4.2"
}

group = "kr.mafoo"
Expand Down Expand Up @@ -35,3 +36,35 @@ dependencies {
tasks.withType<Test> {
useJUnitPlatform()
}

jib {
val activeProfile: String? = System.getenv("SPRING_PROFILES_ACTIVE")
val imageName: String? = System.getenv("IMAGE_NAME")
val imageTag: String? = System.getenv("IMAGE_TAG")
val serverPort: String = System.getenv("SERVER_PORT") ?: "8080"
from {
image = "amazoncorretto:17-alpine3.17-jdk"
}
to {
image = imageName
tags = setOf(imageTag, "latest")
}
container {
jvmFlags =
listOf(
"-Dspring.profiles.active=$activeProfile",
"-Dserver.port=$serverPort",
"-Djava.security.egd=file:/dev/./urandom",
"-Dfile.encoding=UTF-8",
"-Duser.timezone=Asia/Seoul",
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseContainerSupport",
"-XX:+UseG1GC",
"-XX:InitialHeapSize=1g",
"-XX:MaxHeapSize=1g",
"-XX:+DisableExplicitGC", // System.gc() 방어
"-server",
)
ports = listOf(serverPort)
}
}
33 changes: 33 additions & 0 deletions user-service/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
java
id("org.springframework.boot") version "3.3.0"
id("io.spring.dependency-management") version "1.1.5"
id("com.google.cloud.tools.jib") version "3.4.2"
}

group = "kr.mafoo"
Expand Down Expand Up @@ -35,3 +36,35 @@ dependencies {
tasks.withType<Test> {
useJUnitPlatform()
}

jib {
val activeProfile: String? = System.getenv("SPRING_PROFILES_ACTIVE")
val imageName: String? = System.getenv("IMAGE_NAME")
val imageTag: String? = System.getenv("IMAGE_TAG")
val serverPort: String = System.getenv("SERVER_PORT") ?: "8080"
from {
image = "amazoncorretto:17-alpine3.17-jdk"
}
to {
image = imageName
tags = setOf(imageTag, "latest")
}
container {
jvmFlags =
listOf(
"-Dspring.profiles.active=$activeProfile",
"-Dserver.port=$serverPort",
"-Djava.security.egd=file:/dev/./urandom",
"-Dfile.encoding=UTF-8",
"-Duser.timezone=Asia/Seoul",
"-XX:+UnlockExperimentalVMOptions",
"-XX:+UseContainerSupport",
"-XX:+UseG1GC",
"-XX:InitialHeapSize=1g",
"-XX:MaxHeapSize=1g",
"-XX:+DisableExplicitGC", // System.gc() 방어
"-server",
)
ports = listOf(serverPort)
}
}

0 comments on commit be06b9f

Please sign in to comment.