Skip to content

Commit

Permalink
add: nightly builds if SNAPSHOT in version
Browse files Browse the repository at this point in the history
  • Loading branch information
StellaLupus committed Jan 1, 2024
1 parent 7ed4946 commit 0951630
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions comments-app-ktor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,14 @@ tasks {
val registryPref: String? = System.getenv("CONTAINER_REGISTRY_PREF")
val registryName: String = System.getenv("CONTAINER_REGISTRY_NAME") ?: project.name
val imageName = registryPref?.let { "$it/$registryName" } ?: registryName
val nightly: Boolean = rootProject.version.toString().contains("SNAPSHOT")

val dockerBuildX64Image by creating(DockerBuildImage::class) {
group = "docker"
dependsOn(dockerDockerfileX64)
inputDir.set(dockerLinuxX64Dir.parentFile)
images.add("$imageName:${rootProject.version}-x64")
images.add("$imageName:latest-x64")
images.add("$imageName:${if(nightly) "nightly" else "latest"}-x64")
platform.set("linux/amd64")
}
val dockerPushX64Image by creating(DockerPushImage::class) {
Expand All @@ -196,7 +197,7 @@ tasks {
dependsOn(dockerDockerfileArm64)
inputDir.set(dockerLinuxArm64Dir.parentFile)
images.add("$imageName:${rootProject.version}-arm64")
images.add("$imageName:latest-arm64")
images.add("$imageName:${if(nightly) "nightly" else "latest"}-arm64")
platform.set("linux/arm64")
}
val dockerPushArm64Image by creating(DockerPushImage::class) {
Expand Down Expand Up @@ -271,7 +272,7 @@ tasks {
dependsOn(dockerDockerfileJvm)
inputDir.set(dockerJvmDir.parentFile)
images.add("$imageName-jvm:${rootProject.version}")
images.add("$imageName-jvm:latest")
images.add("$imageName-jvm:${if(nightly) "nightly" else "latest"}")
}
val dockerPushJvmImage by creating(DockerPushImage::class) {
group = "docker"
Expand All @@ -295,7 +296,7 @@ tasks {
}
executable("docker")
println("Image name: $imageName")
args("buildx", "build", "--platform", "linux/amd64,linux/arm64", "-t", "$imageName:${rootProject.version}", "-t", "$imageName:latest","--push", ".")
args("buildx", "build", "--platform", "linux/amd64,linux/arm64", "-t", "$imageName:${rootProject.version}", "-t", "$imageName:${if(nightly) "nightly" else "latest"}","--push", ".")
}

create("deploy") {
Expand Down

0 comments on commit 0951630

Please sign in to comment.