|
|
|
@ -605,7 +605,9 @@ artifactoryPublish { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def dockerBuildVersion = project.hasProperty('release.releaseVersion') ? project.property('release.releaseVersion') : "${rootProject.version}" |
|
|
|
|
def dockerImageName = project.hasProperty("dockerImageName") ? project.getProperty("dockerImageName") : "hyperledger/besu" |
|
|
|
|
def dockerOrgName = project.hasProperty('dockerOrgName') ? project.getProperty("dockerOrgName") : "hyperledger" |
|
|
|
|
def dockerArtifactName = project.hasProperty("dockerArtifactName") ? project.getProperty("dockerArtifactName") : "besu" |
|
|
|
|
def dockerImageName = "${dockerOrgName}/${dockerArtifactName}" |
|
|
|
|
def dockerVariants = project.hasProperty("dockerVariants") ? project.getProperty("dockerVariants").split(",") : [ |
|
|
|
|
"openjdk-11", |
|
|
|
|
"openjdk-11-debug", |
|
|
|
@ -639,18 +641,25 @@ task distDocker { |
|
|
|
|
def dockerBuildDir = "build/docker-besu/" |
|
|
|
|
|
|
|
|
|
doLast { |
|
|
|
|
for (def variant in dockerVariants) { |
|
|
|
|
for (def jvmVariant in dockerVariants) { |
|
|
|
|
copy { |
|
|
|
|
from file("${projectDir}/docker/${variant}/Dockerfile") |
|
|
|
|
from file("${projectDir}/docker/${jvmVariant}/Dockerfile") |
|
|
|
|
into(dockerBuildDir) |
|
|
|
|
} |
|
|
|
|
exec { |
|
|
|
|
def image = "${dockerImageName}:${dockerBuildVersion}-${variant}" |
|
|
|
|
def image = "${dockerImageName}:${dockerBuildVersion}-${jvmVariant}" |
|
|
|
|
executable "sh" |
|
|
|
|
workingDir dockerBuildDir |
|
|
|
|
args "-c", "docker build --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ." |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def shaTag = "gitSha-${getCheckedOutGitCommitHash(40)}" //full length sha |
|
|
|
|
exec { |
|
|
|
|
executable "sh" |
|
|
|
|
args "-c", "docker tag '${dockerImageName}:${dockerBuildVersion}-${dockerVariants[0]}' '${dockerImageName}:${shaTag}'" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// tag the "default" (which is the variant in the zero position) |
|
|
|
|
exec { |
|
|
|
|
executable "sh" |
|
|
|
@ -730,10 +739,9 @@ task dockerUpload { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def isInterimBuild = (dockerBuildVersion ==~ /.*-SNAPSHOT/) || (dockerBuildVersion ==~ /.*-alpha/) |
|
|
|
|
|| (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC/) |
|
|
|
|
|| (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/) |
|
|
|
|
|
|
|
|
|
if (!isInterimBuild) { |
|
|
|
|
additionalTags.add('latest') |
|
|
|
|
additionalTags.add(dockerBuildVersion.split(/\./)[0..1].join('.')) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -760,6 +768,7 @@ task dockerUpload { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
task manifestDocker { |
|
|
|
|
dependsOn distDocker |
|
|
|
|
|
|
|
|
|
def image = "${dockerImageName}:${dockerBuildVersion}" |
|
|
|
|
def archs = ["arm64", "amd64"] |
|
|
|
@ -770,7 +779,6 @@ task manifestDocker { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!(dockerBuildVersion ==~ /.*-SNAPSHOT/)) { |
|
|
|
|
tags.add("${dockerImageName}:latest") |
|
|
|
|
tags.add("${dockerImageName}:" + dockerBuildVersion.split(/\./)[0..1].join('.')) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -865,15 +873,16 @@ def calculateVersion() { |
|
|
|
|
return version |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def getCheckedOutGitCommitHash() { |
|
|
|
|
|
|
|
|
|
def getCheckedOutGitCommitHash(length = 8) { |
|
|
|
|
try { |
|
|
|
|
def gitFolder = "$projectDir/.git/" |
|
|
|
|
if (!file(gitFolder).isDirectory()) { |
|
|
|
|
// We are in a submodule. The file's contents are `gitdir: <gitFolder>\n`. |
|
|
|
|
// Read the file, cut off the front, and trim the whitespace. |
|
|
|
|
gitFolder = file(gitFolder).text.substring(8).trim() + "/" |
|
|
|
|
gitFolder = file(gitFolder).text.substring(length).trim() + "/" |
|
|
|
|
} |
|
|
|
|
def takeFromHash = 8 |
|
|
|
|
def takeFromHash = length |
|
|
|
|
/* |
|
|
|
|
* '.git/HEAD' contains either |
|
|
|
|
* in case of detached head: the currently checked out commit hash |
|
|
|
|