I got a gradle task to build docker images for all my projects. These run fine except for the rootProject
which has a dependent task to be executed before the DockerimageBuild itself. This dependency should only apply for the
rootProject` and not the subprojects.
I googled extensively and read the docs but didn't find the perfect solution to add a dependency, probably i am missing a obvious point.
This is my task (stripped out some of the gradle file).
allprojects {
apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin
repositories { jcenter() }
docker {
registryCredentials {
username = dockerRegistryUsername
password = dockerRegistryPassword
}
}
// task build_DockerImage(type: DockerBuildImage, dependsOn: [copy_ImageSource, prepare_ImageConfig]) {
task build_DockerImage(type: DockerBuildImage) {
group 'Docker'
description "Builds the docker image: ${dockerTag} locally"
println "Project: ${rootProject.projectDir}/ci/images/${project.name}"
inputDir = file("${rootProject.projectDir}/ci/images/${project.name}")
tag = "azeti/${project.name}:${dockerTag}"
}
It should have dependsOn: copy_ImageSource
but i can't figure out the right notation for it.
Thanks for your help. Regards, Sebastian