gradle-docker
gradle-docker copied to clipboard
dockerRun doesn't allow dependsOn
the dockerRun task should support the dependsOn flag so that you can ensure that you build the image and then run it.
I ran into this issue as well, but it turns out there is both a dockerRun task and a dockerRun extension. When you try to do dockerRun.dependsOn 'anotherTask' in your build.gradle, you get the following error:
Could not find method dependsOn() for arguments [dockerRemoveContainer] on object of type com.palantir.gradle.docker.DockerRunExtension.
However, I was able to add dependencies to the underlying task like this:
tasks.dockerRun.dependsOn 'anotherTask'
However, I was able to add dependencies to the underlying task like this:
tasks.dockerRun.dependsOn 'anotherTask'
Awesome hint. Using this schema, it does work the other way, too.
anotherTask.dependsOn tasks.dockerRun
I ran into this as well, but in my case I want the image version to be a variable that is set by 'anotherTask'.
No matter what I try, it appears that the dockerRun image field is always initialized before the task that sets the variable is executed.
Any ideas?