diff --git a/spring-boot-reactive-native/build.gradle b/spring-boot-reactive-native/build.gradle deleted file mode 100644 index 6c4d339f..00000000 --- a/spring-boot-reactive-native/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -plugins { - id 'org.springframework.boot' version '3.1.5' - id 'io.spring.dependency-management' version '1.1.4' - id("org.graalvm.buildtools.native") version "0.9.28" - id 'java' -} - -group = 'by.vk' -version = '0.0.1-SNAPSHOT' -sourceCompatibility = '17' - -repositories { - maven { url 'https://repo.spring.io/release' } - mavenCentral() -} - -dependencies { - //region spring - implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") - implementation("org.springframework.boot:spring-boot-starter-webflux") - implementation("org.springframework.boot:spring-boot-starter-actuator") - //endregion - //region logback - implementation("ch.qos.logback.contrib:logback-jackson:0.1.5") - implementation("ch.qos.logback.contrib:logback-json-classic:0.1.5") - //endregion - //region lombok - annotationProcessor("org.projectlombok:lombok") - implementation("org.projectlombok:lombok") - //endregion - //region postgres - implementation("io.r2dbc:r2dbc-postgresql:0.8.13.RELEASE") - //endregion -} - - -bootBuildImage { - buildpacks = ["gcr.io/paketo-buildpacks/java-native-image:8.19.0"] - builder = "paketobuildpacks/builder:tiny" - environment = [ - "BP_NATIVE_IMAGE": "true" - ] -} \ No newline at end of file diff --git a/spring-boot-reactive-native/build.gradle.kts b/spring-boot-reactive-native/build.gradle.kts new file mode 100644 index 00000000..79cd3e9f --- /dev/null +++ b/spring-boot-reactive-native/build.gradle.kts @@ -0,0 +1,70 @@ +plugins { + java + application + id("org.springframework.boot") version "3.1.5" + id("io.spring.dependency-management") version "1.1.4" + id("org.graalvm.buildtools.native") version "0.9.28" + id("com.google.cloud.tools.jib") version "3.4.0" +} + +group = "by.vk" +version = "1.0.0-RC1" + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +configurations { + compileOnly { + extendsFrom(configurations.annotationProcessor.get()) + } +} + +springBoot { + buildInfo() +} + +repositories { + mavenCentral() +} + +dependencies { + //region spring + implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") + implementation("org.springframework.boot:spring-boot-starter-webflux") + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("org.springframework.boot:spring-boot-starter-validation") + //endregion + //region logback + implementation("ch.qos.logback.contrib:logback-jackson:0.1.5") + implementation("ch.qos.logback.contrib:logback-json-classic:0.1.5") + //endregion + //region lombok + annotationProcessor("org.projectlombok:lombok") + implementation("org.projectlombok:lombok") + //endregion + //region postgres + implementation("io.r2dbc:r2dbc-postgresql:0.8.13.RELEASE") + //endregion +} + +tasks.bootBuildImage { + buildpacks.set(listOf("gcr.io/paketo-buildpacks/java-native-image:latest")) + builder.set("paketobuildpacks/builder:tiny") + environment.set(mapOf("BP_NATIVE_IMAGE" to "true")) +} + +jib { + to { + image = "srn-service:latest" + } + from { + image = "gcr.io/distroless/java17:latest" + } + container { + ports = listOf("8080") + labels.set(mapOf("appname" to application.applicationName, "version" to version.toString(), "maintainer" to "Vadzim Kavalkou ")) + creationTime.set("USE_CURRENT_TIMESTAMP") + } +} \ No newline at end of file diff --git a/spring-boot-reactive/build.gradle b/spring-boot-reactive/build.gradle deleted file mode 100644 index 0537b366..00000000 --- a/spring-boot-reactive/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -plugins { - id 'org.springframework.boot' version '3.1.5' - id 'io.spring.dependency-management' version '1.1.4' - id 'java' - id("com.google.cloud.tools.jib") version "3.4.0" -} - -group = 'by.vk' -version = '0.0.1-SNAPSHOT' -sourceCompatibility = '17' - -repositories { - mavenCentral() -} - -dependencies { - //region spring - implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") - implementation("org.springframework.boot:spring-boot-starter-webflux") - implementation("org.springframework.boot:spring-boot-starter-actuator") - implementation("org.springframework:spring-context-indexer") - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") - implementation("org.springframework.boot:spring-boot-starter-validation") - implementation("org.springdoc:springdoc-openapi-ui:1.7.0") - //endregion - //region logback - implementation("ch.qos.logback.contrib:logback-jackson:0.1.5") - implementation("ch.qos.logback.contrib:logback-json-classic:0.1.5") - //endregion - //region lombok - annotationProcessor("org.projectlombok:lombok") - implementation("org.projectlombok:lombok") - //endregion - //region postgres - implementation("io.r2dbc:r2dbc-postgresql:0.8.13.RELEASE") - //endregion -} - -jib { - to { - image = 'reactive-service-a2b:latest' - } - from { - image = "gcr.io/distroless/java17" - } - container { - jvmFlags = ['-noverify', '-XX:+UseContainerSupport', '-XX:MaxRAMPercentage=75.0', '-XX:InitialRAMPercentage=50.0', '-XX:+OptimizeStringConcat', '-XX:+UseStringDeduplication', '-XX:+ExitOnOutOfMemoryError', '-XX:+AlwaysActAsServerClassMachine', '-Xmx512m', '-Xms128m', '-XX:MaxMetaspaceSize=128m', '-XX:MaxDirectMemorySize=256m', '-XX:+HeapDumpOnOutOfMemoryError', '-XX:HeapDumpPath=/opt/tmp/heapdump.bin'] - ports = ['8080'] - labels.set([maintainer: 'Vadzim Kavalkou ', appname: 'a2b-service', version: '0.0.1-SNAPSHOT']) - creationTime = 'USE_CURRENT_TIMESTAMP' - } -} diff --git a/spring-boot-reactive/build.gradle.kts b/spring-boot-reactive/build.gradle.kts new file mode 100644 index 00000000..30d5f5fe --- /dev/null +++ b/spring-boot-reactive/build.gradle.kts @@ -0,0 +1,93 @@ +plugins { + java + application + id("org.springframework.boot") version "3.1.5" + id("io.spring.dependency-management") version "1.1.4" + id("com.google.cloud.tools.jib") version "3.4.0" +} + +group = "by.vk" +version = "1.0.0-RC1" + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +configurations { + compileOnly { + extendsFrom(configurations.annotationProcessor.get()) + } +} + +springBoot { + buildInfo() +} + +repositories { + mavenCentral() +} + +dependencies { + //region spring + annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") + implementation("org.springframework:spring-context-indexer") + implementation("org.springframework.boot:spring-boot-starter-data-r2dbc") + implementation("org.springframework.boot:spring-boot-starter-webflux") + implementation("org.springframework.boot:spring-boot-starter-actuator") + implementation("org.springframework:spring-context-indexer") + annotationProcessor("org.springframework.boot:spring-boot-configuration-processor") + implementation("org.springframework.boot:spring-boot-starter-validation") + //endregion + //region logback + implementation("ch.qos.logback.contrib:logback-jackson:0.1.5") + implementation("ch.qos.logback.contrib:logback-json-classic:0.1.5") + //endregion + //region lombok + annotationProcessor("org.projectlombok:lombok") + implementation("org.projectlombok:lombok") + //endregion + //region postgres + implementation("io.r2dbc:r2dbc-postgresql:0.8.13.RELEASE") + //endregion +} + +object JVMProps { + const val XMX = "512m" + const val XMS = "256m" + const val XSS = "256k" + const val MAX_METASPACE_SIZE = "128m" + const val MAX_DIRECT_MEMORY_SIZE = "128m" + const val HEAPDUMP_PATH = "/opt/tmp/heapdump.bin" + const val MAX_RAM_PERCENTAGE = "80" + const val INITIAL_RAM_PERCENTAGE = "50" +} + +jib { + to { + image = "sr-service:latest" + } + from { + image = "gcr.io/distroless/java21-debian12:latest" + } + container { + jvmFlags = listOf( + "-Xss${JVMProps.XSS}", + "-Xmx${JVMProps.XMX}", + "-Xms${JVMProps.XMS}", + "-XX:MaxMetaspaceSize=${JVMProps.MAX_METASPACE_SIZE}", + "-XX:MaxDirectMemorySize=${JVMProps.MAX_DIRECT_MEMORY_SIZE}", + "-XX:MaxRAMPercentage=${JVMProps.MAX_RAM_PERCENTAGE}", + "-XX:InitialRAMPercentage=${JVMProps.INITIAL_RAM_PERCENTAGE}", + "-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=${JVMProps.HEAPDUMP_PATH}", + "-XX:+UseContainerSupport", + "-XX:+OptimizeStringConcat", + "-XX:+UseStringDeduplication", + "-XX:+ExitOnOutOfMemoryError", + "-XX:+AlwaysActAsServerClassMachine") + ports = listOf("8080") + labels.set(mapOf("appname" to application.applicationName, "version" to version.toString(), "maintainer" to "Vadzim Kavalkou ")) + creationTime.set("USE_CURRENT_TIMESTAMP") + } +}