Skip to content

Commit 580ba8c

Browse files
committed
Refactor
1 parent 0e6df01 commit 580ba8c

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

build.gradle.kts

+9-14
Original file line numberDiff line numberDiff line change
@@ -42,33 +42,28 @@ tasks.wrapper {
4242
tasks.register("buildImage", type = Exec::class) {
4343
dependsOn("jpackage")
4444
commandLine("docker", "compose", "--profile", "local", "build")
45-
46-
environment(
47-
"REGISTRY" to (environment["REGISTRY"] ?: "k3d.localhost:5000/"),
48-
"VERSION" to version
49-
)
45+
dockerEnvironment()
5046
}
5147

5248
tasks.register("push", type = Exec::class) {
5349
dependsOn("buildImage")
5450
commandLine("docker", "compose", "--profile", "local", "push")
55-
56-
environment(
57-
"REGISTRY" to (environment["REGISTRY"] ?: "k3d.localhost:5000/"),
58-
"VERSION" to version
59-
)
51+
dockerEnvironment()
6052
}
6153

6254
tasks.register("up", type = Exec::class) {
6355
dependsOn("push")
6456
commandLine("docker", "compose", "--profile", "local", "up", "-d")
57+
dockerEnvironment()
58+
}
59+
60+
tasks.register("rm", type = Exec::class) {
61+
commandLine("docker", "compose", "--profile", "local", "rm", "-sfv")
62+
}
6563

64+
fun Exec.dockerEnvironment() {
6665
environment(
6766
"REGISTRY" to (environment["REGISTRY"] ?: "k3d.localhost:5000/"),
6867
"VERSION" to version
6968
)
7069
}
71-
72-
tasks.register("rm", type = Exec::class) {
73-
commandLine("docker", "compose", "--profile", "local", "rm", "-sfv")
74-
}

0 commit comments

Comments
 (0)