diff --git a/build.gradle b/build.gradle index 0e06bead843..1aa6991e4e3 100644 --- a/build.gradle +++ b/build.gradle @@ -499,9 +499,10 @@ def dockerImage = "consensys/teku" def dockerJdkVariants = [ "jdk17" ] def dockerBuildDir = "build/docker-teku/" +def executableAndArg = System.getProperty('os.name').toLowerCase().contains('windows') ? ["cmd", "/c"] : ["sh", "-c"] + task distDocker { dependsOn dockerDistUntar - def dockerBuildVersion = 'develop' doLast { for (def variant in dockerJdkVariants) { @@ -512,14 +513,14 @@ task distDocker { exec { def image = "${dockerImage}:${dockerBuildVersion}-${variant}" workingDir dockerBuildDir - executable "sh" - args "-c", "docker build --pull --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ." + executable executableAndArg[0] + args executableAndArg[1], "docker build --pull --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ." } } // tag the "default" (which is the variant in the zero position) exec { - executable "sh" - args "-c", "docker tag '${dockerImage}:${dockerBuildVersion}-${dockerJdkVariants[0]}' '${dockerImage}:${dockerBuildVersion}'" + executable executableAndArg[0] + args executableAndArg[1], "docker tag ${dockerImage}:${dockerBuildVersion}-${dockerJdkVariants[0]} ${dockerImage}:${dockerBuildVersion}" } } } @@ -556,8 +557,8 @@ task uploadDocker { exec { workingDir dockerBuildDir - executable "sh" - args "-c", "docker build --pull --platform ${platform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} ${tags} ." + executable executableAndArg[0] + args executableAndArg[1], "docker build --pull --platform ${platform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} ${tags} ." } //docker trust sign runs one image at a time, so we have to remove the '-t' in the string and split into a list we can use @@ -565,8 +566,8 @@ task uploadDocker { for (def t in trustTags) { exec { workingDir dockerBuildDir - executable "sh" - args "-c", "docker trust sign ${t} && docker push ${t} " + executable executableAndArg[0] + args executableAndArg[1], "docker trust sign ${t} && docker push ${t} " } } } @@ -600,8 +601,8 @@ task manifestDocker { for (def tag in tags) { platforms.forEach { platform -> cmd += "${tag}-${platform} " } exec { - executable "sh" - args "-c", "docker manifest create ${tag} ${cmd} && docker manifest push ${tag}" + executable executableAndArg[0] + args executableAndArg[1], "docker manifest create ${tag} ${cmd} && docker manifest push ${tag}" } } }