Skip to content

Commit

Permalink
Added publishing of docker image to registry.polach.cloud
Browse files Browse the repository at this point in the history
  • Loading branch information
dapolach committed Sep 10, 2024
1 parent a26f547 commit 9a0e752
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.apache.commons.lang3.StringUtils
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage

/*
Expand All @@ -24,7 +25,6 @@ description = "klabis"
java.sourceCompatibility = JavaVersion.VERSION_21



//val dockerImageName = "registry.polach.cloud/zbm/web-2.0/${group}.${description}:${project.version}"
val dockerImageName = "registry.polach.cloud/zbm/web-2.0/${description}:${project.version}"
println(dockerImageName)
Expand Down Expand Up @@ -128,31 +128,33 @@ openApiGenerate {
modelPackage.set("club.klabis.api.dto")
modelNameSuffix.set("ApiDto")
library.set("spring-boot")
configOptions.putAll(mapOf(
"dateLibrary" to "java8",
"useSpringBoot3" to "true",
"generateBuilders" to "true",
"useSpringController" to "false",
//"hateoas" to "false",
"booleanGetterPrefix" to "is",
"interfaceOnly" to "true",
"defaultInterfaces" to "false",
"useBeanValidation" to "true"
))
configOptions.putAll(
mapOf(
"dateLibrary" to "java8",
"useSpringBoot3" to "true",
"generateBuilders" to "true",
"useSpringController" to "false",
//"hateoas" to "false",
"booleanGetterPrefix" to "is",
"interfaceOnly" to "true",
"defaultInterfaces" to "false",
"useBeanValidation" to "true"
)
)
}

tasks.compileJava.get().dependsOn(tasks.openApiGenerate)

tasks.getByName<BootBuildImage>("bootBuildImage") {
imageName = dockerImageName
// publish = true
// docker {
// publishRegistry {
// username = "user"
// password = "secret"
// url = "https://docker.example.com/v1/"
// email = "user@example.com"
// }
// }
publish = StringUtils.isNotBlank(System.getenv("DOCKER_USERNAME")) && StringUtils.isNotBlank(System.getenv("DOCKER_PASSWORD"))
docker {
publishRegistry {
username = StringUtils.defaultIfBlank(System.getenv("DOCKER_USERNAME"), "dummy")
password = StringUtils.defaultIfBlank(System.getenv("DOCKER_PASSWORD"), "dummy")
url = "https://registry.polach.cloud"
email = "gradle@noreply.com"
}
}
}

0 comments on commit 9a0e752

Please sign in to comment.