Skip to content

Commit

Permalink
Make docker build task incremental (#49613)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rjernst authored Nov 27, 2019
1 parent 6c54b38 commit ffaf836
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion distribution/docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ project.ext {

void addCopyDockerContextTask(final boolean oss, final boolean ubi) {
task(taskName("copy", oss, ubi, "DockerContext"), type: Sync) {
expansions(oss, ubi, true).each { k, v ->
expansions(oss, ubi, true).findAll { it.key != 'build_date' }.each { k, v ->
inputs.property(k, { v.toString() })
}
into buildPath(oss, ubi)
Expand Down Expand Up @@ -173,6 +173,11 @@ void addBuildDockerImage(final boolean oss, final boolean ubi) {
dockerArgs.add(tag)
}
args dockerArgs.toArray()
File markerFile = file("build/markers/${it.name}.marker")
outputs.file(markerFile)
doLast {
markerFile.setText('', 'UTF-8')
}
}
assemble.dependsOn(buildDockerImageTask)
BuildPlugin.requireDocker(buildDockerImageTask)
Expand Down Expand Up @@ -209,6 +214,7 @@ subprojects { Project subProject ->

final Task exportDockerImageTask = task(exportTaskName, type: LoggedExec) {
executable 'docker'
outputs.file(tarFile)
args "save",
"-o",
tarFile,
Expand Down

0 comments on commit ffaf836

Please sign in to comment.