gradle-docker icon indicating copy to clipboard operation
gradle-docker copied to clipboard

dockerRun doesn't allow dependsOn

Open dgutzmann opened this issue 6 years ago • 3 comments

the dockerRun task should support the dependsOn flag so that you can ensure that you build the image and then run it.

dgutzmann avatar Mar 12 '19 15:03 dgutzmann

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'

aguibert avatar Mar 14 '19 21:03 aguibert

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

SchulteDev avatar Feb 10 '20 09:02 SchulteDev

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?

reinouts avatar Jan 06 '22 20:01 reinouts