Skip to content

Commit 9c6a5a0

Browse files
committed
Make docker build task incremental (#49613)
This commits sets an output marker file for the docker build tasks so that it can be tracked as up to date. It also fixes the docker build context task to omit the build date as in input property which always left the task as out of date. relates #49359
1 parent d66795f commit 9c6a5a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

distribution/docker/build.gradle

+7-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ project.ext {
7272

7373
void addCopyDockerContextTask(final boolean oss, final boolean ubi) {
7474
task(taskName("copy", oss, ubi, "DockerContext"), type: Sync) {
75-
expansions(oss, ubi, true).each { k, v ->
75+
expansions(oss, ubi, true).findAll { it.key != 'build_date' }.each { k, v ->
7676
inputs.property(k, { v.toString() })
7777
}
7878
into buildPath(oss, ubi)
@@ -173,6 +173,11 @@ void addBuildDockerImage(final boolean oss, final boolean ubi) {
173173
dockerArgs.add(tag)
174174
}
175175
args dockerArgs.toArray()
176+
File markerFile = file("build/markers/${it.name}.marker")
177+
outputs.file(markerFile)
178+
doLast {
179+
markerFile.setText('', 'UTF-8')
180+
}
176181
}
177182
assemble.dependsOn(buildDockerImageTask)
178183
BuildPlugin.requireDocker(buildDockerImageTask)
@@ -209,6 +214,7 @@ subprojects { Project subProject ->
209214

210215
final Task exportDockerImageTask = task(exportTaskName, type: LoggedExec) {
211216
executable 'docker'
217+
outputs.file(tarFile)
212218
args "save",
213219
"-o",
214220
tarFile,

0 commit comments

Comments
 (0)