diff --git a/build.gradle b/build.gradle index 8e6791b..d0e3374 100644 --- a/build.gradle +++ b/build.gradle @@ -124,6 +124,10 @@ tasks.register("stop") { } buildDockerImage { + doFirst { + waitForCommand("docker pull ${gradle.liferayWorkspace.dockerImageLiferay}", null, true) + } + onlyIf("using the Liferay service") { config.useLiferay } diff --git a/buildSrc/src/main/groovy/docker-common.gradle b/buildSrc/src/main/groovy/docker-common.gradle index 63a605c..14a9c5b 100644 --- a/buildSrc/src/main/groovy/docker-common.gradle +++ b/buildSrc/src/main/groovy/docker-common.gradle @@ -323,14 +323,17 @@ ext { } waitForCommand = { - String command, File cwd = null -> + String command, File cwd = null, boolean streamOutput = false -> - ByteArrayOutputStream stdout = new ByteArrayOutputStream() + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream() ExecResult execResult = project.exec { commandLine "bash", "-c", command ignoreExitValue true - standardOutput stdout + + if (streamOutput == false) { + standardOutput byteArrayOutputStream + } if (cwd != null) { workingDir cwd @@ -339,7 +342,7 @@ ext { execResult.assertNormalExitValue() - return stdout.toString().trim() + return byteArrayOutputStream.toString().trim() } waitForContainer = { diff --git a/buildSrc/src/main/groovy/docker-liferay-bundle.gradle b/buildSrc/src/main/groovy/docker-liferay-bundle.gradle index 81771d5..68254aa 100644 --- a/buildSrc/src/main/groovy/docker-liferay-bundle.gradle +++ b/buildSrc/src/main/groovy/docker-liferay-bundle.gradle @@ -117,9 +117,9 @@ Closure copyLiferayLicenseFromDXPImage = { return null } - println "Docker image ${imageName} is not available, retrieving via docker pull (this may take awhile)" + println "Checking image ${imageName} for a valid license file to copy, retrieving via docker pull (this may take awhile)" - waitForCommand("docker pull ${imageName}") + waitForCommand("docker pull ${imageName}", null, true) latestImageName = getLatestImageNameLocal(imageName)