Skip to content

Commit

Permalink
Allow -Pdocker-platform during distDocker
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gezero committed Dec 15, 2022
1 parent 8521822 commit 42a7abb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,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} ."
}
}

Expand Down

0 comments on commit 42a7abb

Please sign in to comment.