Dockerfile.{uat, prod}
FROM gradle:8.10.0-jdk21-alpine AS build WORKDIR /app COPY . . RUN gradle clean build --no-daemon FROM eclipse-temurin:21-jre-alpine WORKDIR /app COPY /app/build/libs/payment-0.0.1-SNAPSHOT.jar . CMD ["java","-Dspring.profiles.active=uat", "-jar", "payment-0.0.1-SNAPSHOT.jar"]
- Replace
uat
byprod
forDockerfile.prod
.
build.gradle.kts
import org.jetbrains.kotlin.gradle.dsl.JvmTarget group = "com.machingclee" version = "0.0.1-SNAPSHOT" java.sourceCompatibility = JavaVersion.VERSION_21 kotlin { compilerOptions { freeCompilerArgs.addAll("-Xjsr305=strict") } } tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile>().configureEach { compilerOptions { jvmTarget.set(JvmTarget.JVM_21) } } tasks.withType<Test> { useJUnitPlatform() } tasks.getByName<Jar>("jar") { manifest { attributes["Main-Class"] = "com.machingclee.payment.PaymentApplicationKt" } }
-
-Xjsr305=strict
is required to let compiler run for nullity type-check. -
Because we are using
kotlin
, make sure to add aKt
suffix in the classname: