Configuring a base image built earlier in the Gradle build
See original GitHub issueI’d like to use a base image for Jib that was built (via a normal Dockerfile
) earlier in the Gradle build. (This lets me use a base OS and JDK of my choosing with project-specific other things that aren’t easily done by simply copying files from the project via jib’s extraDirectories
.)
The image is built like this using https://bmuschko.github.io/gradle-docker-plugin/:
task buildBaseDockerImg(type: DockerBuildImage) {
inputDir = file("$rootProject.projectDir/docker")
}
I can get the sha256:...
string for the image with another task:
task inspect(type: DockerInspectImage) {
dependsOn buildBaseDockerImg
targetImageId buildBaseDockerImg.imageId
onNext { image ->
// the sha256:.. is at `image.config.image`
}
}
However, in the onNext
closure seems to be too late to configure the jib
extension to use the sha256:...
. Is there a way to do this?
Note: even when I configure the jib
extension with something like
jib {
from {
image = 'sha256:...'
}
it still seems to be trying to pull that from a repository, which of course doesn’t work since I didn’t push it anywhere. Does jib only know how to use base images that it pulls from a repo?
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (8 by maintainers)
Top GitHub Comments
@marshallpierce to clarify, what I mean is doing something like this in your build.gradle and using that
uuidTag
everywhereGotcha. I’ll go ahead and close this for now. Please open a new bug if you’re having trouble further optimizing your build with jib.