use ktor native fatJar task
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
FROM bellsoft/liberica-openjdk-alpine:21
|
||||
|
||||
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
|
||||
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")
|
||||
}
|
||||
|
||||
ktor {
|
||||
fatJar {
|
||||
archiveFileName.set("server-fat.jar")
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
register("fatJar", Jar::class) {
|
||||
archiveBaseName = "server-fat"
|
||||
manifest {
|
||||
attributes["Implementation-Title"] = "Videobox Server"
|
||||
attributes["Implementation-Version"] = version
|
||||
attributes["Main-Class"] = mainClassName
|
||||
named("build") {
|
||||
dependsOn("buildFatJar")
|
||||
}
|
||||
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") {
|
||||
dependsOn("fatJar")
|
||||
dependsOn("buildFatJar")
|
||||
commandLine(
|
||||
getCommandLine(
|
||||
"docker context use remote",
|
||||
@@ -92,9 +85,8 @@ tasks {
|
||||
)
|
||||
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
|
||||
}
|
||||
|
||||
register<Exec>("deployLocal") {
|
||||
dependsOn("fatJar")
|
||||
dependsOn("buildFatJar")
|
||||
commandLine(
|
||||
getCommandLine(
|
||||
"docker compose down",
|
||||
@@ -104,6 +96,7 @@ tasks {
|
||||
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCommandLine(vararg commands: String): List<String> {
|
||||
val osName = System.getProperty("os.name").lowercase()
|
||||
return if (osName.contains("win")) {
|
||||
|
||||
Reference in New Issue
Block a user