add backend publication ext
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user