jib
jib copied to clipboard
Unable to create multiple docker build tasks with single build.gradle file
Environment: development
- Jib version: 3.3.1
- Build tool: Gradle
- OS: ubuntu
Description of the issue: I have two application with same root project and wanted to create two jib build tasks with build.gradle file but unable to achieve that error: cannot create jib tasks as dorectly extending abstracttask is not supported Expected behavior:
Steps to reproduce:
- added two jib tasks for container code in build.gradle
- with jenkins stage :: rungradle(build, jib, ....
- fails on above mentioned error
jib-gradle-plugin Configuration:
plugins {
id 'java'
id 'com.google.cloud.tools.jib' version '3.1.1'
}
repositories {
mavenCentral()
}
dependencies {
// your dependencies here
}
jibdevapp1 {
from {
image = 'gcr.io/distroless/java:11'
auth {
username = 'your-source-username'
password = 'your-source-password'
}
}
to {
image = 'your-registry/your-image-name'
auth {
username = 'your-target-username'
password = 'your-target-password'
}
}
container {
entrypoint = ['java', '-cp', '/app/classes:/app/libs/*', 'com.example.Main']
creationTime = 'USE_CURRENT_TIMESTAMP'
format = 'Docker'
}
extraDirectories {
paths = ["${buildDir}/optf"]
permissions = [
'/optf/scripts/start.sh': '755'
]
}
}
jibdevapp2 {
from {
image = 'gcr.io/distroless/java:11'
auth {
username = 'your-source-username'
password = 'your-source-password'
}
}
to {
image = 'your-registry/your-image-name'
auth {
username = 'your-target-username'
password = 'your-target-password'
}
}
container {
entrypoint = ['java', '-cp', '/app/classes:/app/libs/*', 'com.example.Main']
creationTime = 'USE_CURRENT_TIMESTAMP'
format = 'Docker'
}
extraDirectories {
paths = ["${buildDir}/optf"]
permissions = [
'/optf/scripts/start.sh': '755'
]
}
}
task jibDockerBuild {
group = "jib"
description = "Build all Docker images"
dependsOn 'jibdevapp21', 'jibdevapp2'
}
Log output: Error:: cannot create task jibdevapp1 as directly extending abstractTask is not supported Let me know if there is any workaround for this, i have also tried to create function of jib and provide the both images data as variable in loop but it still fails on the same error. Additional Information:
@mpeddada1 @chanseokoh any comment on above issues
hey @blakeli0, Thanks for looking into it, any comment on above issue? is it possible to create two container images with single build.gradle file? if yes, then please provide me way to do this, thanks
CC: @ldetmer @mpeddada1 @lqiu96
Interested in this as well, my use case is to have one app, but we want to publish app with multiple base(from) configurations. You can see this often used, where single app has various bases, like alpine vs debian base images
@krishnakekan619 Are you in a multi-project setup? Perhaps something like https://github.com/GoogleContainerTools/jib/blob/master/examples/multi-module/README.md?plain=1 could be used in this case.