Allow -Pdocker-platform during distDocker (#4828)

As an example of usecase - this should make it easier to build linux/amd64 images on M1.

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>

Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/4887/head
Jiri Peinlich 2 years ago committed by GitHub
parent 9dbf12058a
commit fbe4ba571f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      build.gradle

@ -649,9 +649,14 @@ task distDocker {
}
exec {
def image = "${dockerImageName}:${dockerBuildVersion}-${jvmVariant}"
def dockerPlatform = ""
if (project.hasProperty('docker-platform')){
dockerPlatform = "--platform ${project.getProperty('docker-platform')}"
println "Building for platform ${project.getProperty('docker-platform')}"
}
executable "sh"
workingDir dockerBuildDir
args "-c", "docker build --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ."
args "-c", "docker build ${dockerPlatform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ."
}
}

Loading…
Cancel
Save