Closed zgqq closed 1 year ago
jib config
apply plugin: "com.google.cloud.tools.jib"
ext.jvmArgs = applicationDefaultJvmArgs
System.setProperty("jib.httpTimeout", '0')
def executeDockerBuild = false
def executeDockerBuildLocal = false
def executingTasks = project.gradle.startParameter.taskNames
if (executingTasks != null && !executingTasks.isEmpty()) {
executeDockerBuild = 'jib' in executingTasks
|| 'jibDockerBuild' in executingTasks
executeDockerBuildLocal = 'jibDockerBuild' in executingTasks
}
//if (executeDockerBuild) {
// if (!isDocker(env)) {
// throw new RuntimeException("Executing jib task need to docker env, current:" + env)
// }
//}
ext.jibPlatform = "linux/arm64"
if (hasProperty("platform")) {
println("Using specific docker platform, $platform")
ext.jibPlatform = "$platform"
}
def dockerBaseImage = 'ibm-semeru-runtimes:open-17-jre-jammy'
def tag = "default"
if (hasProperty("dockerBaseImage")) {
dockerBaseImage = ext.dockerBaseImage
tag = "config"
}
println("Using ${dockerBaseImage} image by ${tag}")
jib {
from {
// image = 'amazoncorretto:8u232'
// image = 'https://reg.qiniu.com/open-flycat/flycat:latest'
// image = 'https://reg.qiniu.com/open-flycat/flycat-openj9:latest'
// image = 'zgqq/flycat-jdk17:latest'
image = dockerBaseImage
platforms {
if (jibPlatform == "linux/amd64") {
println("Using docker platform, linux/amd64, specific platform: $jibPlatform")
platform {
architecture = 'amd64'
os = 'linux'
}
} else {
println("Using docker platform, linux/arm64, specific platform: $jibPlatform")
platform {
architecture = 'arm64'
os = 'linux'
}
}
}
}
extraDirectories {
paths = [file('build/jib')]
}
to {
image = dockerImage
// https://github.com/GoogleContainerTools/jib/issues/2182
credHelper = 'docker-credential-osxkeychain'
tags = [env.toString() + '-' + (new Date().format("yyyyMMdd_HHmmss")).toString(), env.toString()]
if (!executeDockerBuildLocal) {
if (project.hasProperty('dockerUsername')) {
auth {
println "image $dockerImage username $dockerUsername"
username = dockerUsername
password = dockerPassword
}
}
}
}
container {
jvmFlags = jvmArgs
mainClass = mainClassName
// ports = [containerPort.toString(), debugServerPort.toString()]
ports = [containerPort.toString()]
volumes = ['/app', '/userapp/data', '/userapp/logs']
creationTime = 'USE_CURRENT_TIMESTAMP'
}
// allowInsecureRegistries = true
}
Jib uses Gradle's main source set. You should investigate whether the source set is what you want it to be.
Closing due to lack of response.
Environment:
Gradle 7.5.1
Build time: 2022-08-05 21:17:56 UTC Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21 Groovy: 3.0.10 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 17.0.4.1 (Eclipse Adoptium 17.0.4.1+1) OS: Mac OS X 12.6 aarch64
root@f206f84cf4b2:/app# ls classes jib-classpath-file jib-main-class-file libs
Log output:
Additional Information: