Skip to content

Commit 224f471

Browse files
committed
Make docker build task incremental
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 elastic#49359
1 parent 9cc247d commit 224f471

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

distribution/docker/build.gradle

Lines changed: 6 additions & 1 deletion
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)

0 commit comments

Comments
 (0)