diff --git a/apps/vbox/backend/Dockerfile b/apps/vbox/backend/Dockerfile index d8d5e16..e27488f 100644 --- a/apps/vbox/backend/Dockerfile +++ b/apps/vbox/backend/Dockerfile @@ -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"] diff --git a/apps/vbox/backend/build.gradle.kts b/apps/vbox/backend/build.gradle.kts index c1fbcd3..a8777f5 100644 --- a/apps/vbox/backend/build.gradle.kts +++ b/apps/vbox/backend/build.gradle.kts @@ -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 - } - from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) }) - duplicatesStrategy = DuplicatesStrategy.WARN - with(jar.get() as CopySpec) + named("build") { + dependsOn("buildFatJar") } - - "build" { - dependsOn("fatJar") - } - register("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("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 { val osName = System.getProperty("os.name").lowercase() return if (osName.contains("win")) {