You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In its simplest form, an output (file/directory) that is created by a task in project A is attached to a configuration in project A.
To use it from project B, a configuration is created and a dependency is added on project(path: ":projectA", configuration: "XX"), which is then consumed by the task from project B that needs the artifact.
Automatically create an outgoing configuration named dockerImage. This configuration should have a single artifact that represents the image ID of the image built by buildDockerImage. Since configurations can only contain files, it shall be a textfile containing the image ID. The artifact should also be builtBy(buildDockerImage), so it is automatically built when the configuration is consumed an used.
On the consuming side, a Dockerfile convention should add a method: from(Configuration), which will add a dependency on the configuration, and internally wire to from(Provider<String>). In the provider, we will assert that there is only a single file present in the configuration (with Configuration#getSingleFile()), and then read the image ID from that file.
The text was updated successfully, but these errors were encountered:
For normal gradle artifacts, consuming them from another subproject of the build works with cross-project publications: https://docs.gradle.org/current/userguide/cross_project_publications.html#sec:simple-sharing-artifacts-between-projects
How it is now
Currently, docker images can not be consumed this way, which prevents some nice things from working:
How Gradle does it for other artifacts
In its simplest form, an output (file/directory) that is created by a task in project A is attached to a configuration in project A.
To use it from project B, a configuration is created and a dependency is added on
project(path: ":projectA", configuration: "XX")
, which is then consumed by the task from project B that needs the artifact.How it could be
Necessary changes
Automatically create an outgoing configuration named
dockerImage
. This configuration should have a single artifact that represents the image ID of the image built bybuildDockerImage
. Since configurations can only contain files, it shall be a textfile containing the image ID. The artifact should also bebuiltBy(buildDockerImage)
, so it is automatically built when the configuration is consumed an used.On the consuming side, a
Dockerfile
convention should add a method:from(Configuration)
, which will add a dependency on the configuration, and internally wire tofrom(Provider<String>)
. In the provider, we will assert that there is only a single file present in the configuration (withConfiguration#getSingleFile()
), and then read the image ID from that file.The text was updated successfully, but these errors were encountered: