use ktor native fatJar task
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
FROM bellsoft/liberica-openjdk-alpine:21
|
FROM bellsoft/liberica-openjdk-alpine:21
|
||||||
|
|
||||||
WORKDIR /usr/local/app
|
WORKDIR /usr/local/app
|
||||||
COPY ./build/libs/server-fat-1.0.jar ./server-fat-1.0.jar
|
COPY ./build/libs/server-fat.jar ./server-fat.jar
|
||||||
EXPOSE 8181
|
EXPOSE 8181
|
||||||
CMD ["java", "-jar", "server-fat-1.0.jar"]
|
CMD ["java", "-jar", "server-fat.jar"]
|
||||||
|
|||||||
@@ -64,25 +64,18 @@ application {
|
|||||||
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
|
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ktor {
|
||||||
|
fatJar {
|
||||||
|
archiveFileName.set("server-fat.jar")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
register("fatJar", Jar::class) {
|
named("build") {
|
||||||
archiveBaseName = "server-fat"
|
dependsOn("buildFatJar")
|
||||||
manifest {
|
|
||||||
attributes["Implementation-Title"] = "Videobox Server"
|
|
||||||
attributes["Implementation-Version"] = version
|
|
||||||
attributes["Main-Class"] = mainClassName
|
|
||||||
}
|
|
||||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
|
||||||
duplicatesStrategy = DuplicatesStrategy.WARN
|
|
||||||
with(jar.get() as CopySpec)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"build" {
|
|
||||||
dependsOn("fatJar")
|
|
||||||
}
|
|
||||||
|
|
||||||
register<Exec>("deployRemote") {
|
register<Exec>("deployRemote") {
|
||||||
dependsOn("fatJar")
|
dependsOn("buildFatJar")
|
||||||
commandLine(
|
commandLine(
|
||||||
getCommandLine(
|
getCommandLine(
|
||||||
"docker context use remote",
|
"docker context use remote",
|
||||||
@@ -92,9 +85,8 @@ tasks {
|
|||||||
)
|
)
|
||||||
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
|
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
|
||||||
}
|
}
|
||||||
|
|
||||||
register<Exec>("deployLocal") {
|
register<Exec>("deployLocal") {
|
||||||
dependsOn("fatJar")
|
dependsOn("buildFatJar")
|
||||||
commandLine(
|
commandLine(
|
||||||
getCommandLine(
|
getCommandLine(
|
||||||
"docker compose down",
|
"docker compose down",
|
||||||
@@ -104,6 +96,7 @@ tasks {
|
|||||||
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
|
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCommandLine(vararg commands: String): List<String> {
|
private fun getCommandLine(vararg commands: String): List<String> {
|
||||||
val osName = System.getProperty("os.name").lowercase()
|
val osName = System.getProperty("os.name").lowercase()
|
||||||
return if (osName.contains("win")) {
|
return if (osName.contains("win")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user