add backend publication ext

This commit is contained in:
2026-09-14 22:35:39 +03:00
parent 5ff633fc4d
commit e3643012c6
2 changed files with 43 additions and 37 deletions
+5 -37
View File
@@ -1,3 +1,5 @@
import ru.shadowsparky.setupBackendPublication
plugins {
alias(libs.plugins.convention.backend.app)
alias(libs.plugins.ktor)
@@ -60,43 +62,9 @@ application {
}
ktor {
fatJar {
archiveFileName.set("server-fat.jar")
docker {
localImageName = "giga-wear-backend"
}
}
tasks {
named("build") {
dependsOn("buildFatJar")
}
register<Exec>("deployRemote") {
dependsOn("buildFatJar")
commandLine(
getCommandLine(
"docker context use remote",
"docker build . -t gigawear-server",
"docker context use default"
)
)
notCompatibleWithConfigurationCache("This task uses Exec which is not compatible with configuration cache")
}
register<Exec>("deployLocal") {
dependsOn("buildFatJar")
commandLine(
getCommandLine(
"docker compose down",
"docker compose up -d --build --force-recreate"
)
)
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")) {
listOf("cmd", "/c") + commands.joinToString(" && ")
} else {
listOf("sh", "-c") + commands.joinToString(" && ")
}
}
setupBackendPublication()