diff --git a/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerBuildTask.kt b/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerBuildTask.kt index 549faa2a8c..89f6896138 100644 --- a/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerBuildTask.kt +++ b/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerBuildTask.kt @@ -1,23 +1,27 @@ package bisq.gradle.docker.image_builder import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty import org.gradle.api.provider.Property +import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputDirectory import org.gradle.api.tasks.TaskAction -import java.io.File import java.util.concurrent.TimeUnit abstract class DockerBuildTask : DefaultTask() { @get:InputDirectory - abstract val dockerDirectory: Property + abstract val dockerDirectory: DirectoryProperty + + @get:Input + abstract val imageTag: Property @TaskAction fun build() { val processBuilder = ProcessBuilder( "docker", "build", - "--tag", "bisq/seednode:latest", - dockerDirectory.get().absolutePath + "--tag", imageTag.get(), + dockerDirectory.asFile.get().absolutePath ) processBuilder.redirectErrorStream(true) diff --git a/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerImageBuilderPlugin.kt b/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerImageBuilderPlugin.kt index d5f6f3b387..f8d6eb2ebb 100644 --- a/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerImageBuilderPlugin.kt +++ b/build-logic/docker-image-builder/src/main/java/bisq/gradle/docker/image_builder/DockerImageBuilderPlugin.kt @@ -20,9 +20,10 @@ class DockerImageBuilderPlugin : Plugin { val installDistTask: TaskProvider = project.tasks.named("installDist", Sync::class.java) val distTarTask: TaskProvider = project.tasks.named("distTar", Tar::class.java) + val seednodeBuildDir = project.layout.buildDirectory.dir("docker") val copyTask = project.tasks.register("copyDistTar") { from(distTarTask.flatMap { it.archiveFile }) - into(project.layout.buildDirectory.dir("docker")) + into(seednodeBuildDir) } project.tasks.register("generateDockerfile") { @@ -38,8 +39,10 @@ class DockerImageBuilderPlugin : Plugin { outputFile.set(project.layout.buildDirectory.file("docker/Dockerfile")) } - project.tasks.register("dockerImage") { - dockerDirectory.set(copyTask.map { it.destinationDir }) + project.tasks.register("seednodeDockerImage") { + dependsOn(copyTask) + imageTag.set("bisq/seednode:latest") + dockerDirectory.set(seednodeBuildDir) } } }