使用jib进行多项目构建



我有一个多模块项目,我正在尝试使用gradle 7.5.1和jib来构建每个服务工件并将其部署到ECR。

我有一个~/.doker/config.json文件

{
"credsStore": "desktop"
}
{
"credHelpers": {
"public.ecr.aws": "ecr-login",
"xxxxxxx.dkr.ecr.us-east-1.amazonaws.com": "ecr-login"
}
}

我的AWS密钥在~/.AWS/credentials

我的每个模块都有一个settings.gradle,它将rootProject.name定义为服务(artifactId(,以及插件"maven publish"。

在我的主要项目中,我有一个构建。gradle:

plugins {
id 'java'
id 'groovy'
id 'com.google.cloud.tools.jib' version '3.3.0'
id 'maven-publish'
} 
..
jib {
from {
image = 'azul/zulu-openjdk:17-jre'
}
to {
image = 'xxxxxxx.dkr.ecr.us-east-1.amazonaws.com/${rootProject.name}'
// I have also tried image = 'xxxxxxx.dkr.ecr.us-east-1.amazonaws.com/${artifactId}'
}
}

当我试图通过gradle jib构建它们时,我得到了以下错误:

> Task :jib FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':jib'.
> Invalid image reference xxxxxxx.dkr.ecr.us-east-1.amazonaws.com/${rootProject.name}, perhaps you should check that the reference is formatted correctly according to https://docs.docker.com/engine/reference/commandline/tag/#extended-description
For example, slash-separated name components cannot have uppercase letters

stacktrace还提到了无效引用。

我正在学习一些教程和谷歌jib文档,但我没有发现我做错了什么——其他人知道吗?

使用双引号而不是单引号使Gradle扩展属性。

相关内容

  • 没有找到相关文章

最新更新