【发布时间】:2021-03-28 18:57:17
【问题描述】:
以下 sn-p (Node/Typescript) 利用 Google 的 CloudBuild API (v1) 构建容器并推送到 Google 的 Container Registry (GCR)。如果可能,让 CloudBuild 将映像推送到 AWS ECR 而不是 GCR 的正确方法是什么?
import { cloudbuild_v1 } from "googleapis";
[...]
const manifestLocation = `gs://${manifestFile.bucket}/${manifestFile.fullpath}`;
const buildDestination = `gcr.io/${GOOGLE_PROJECT_ID}/xxx:yyy`;
const result = await builds.create({
projectId: GOOGLE_PROJECT_ID,
requestBody: {
steps: [
{
name: 'gcr.io/cloud-builders/gcs-fetcher',
args: [
'--type=Manifest',
`--location=${manifestLocation}`
]
},
{
name: 'docker',
args: ['build', '-t', buildDestination, '.'],
}
],
images: [buildDestination]
}
})```
【问题讨论】:
-
按照Pushing a Docker image中的步骤,看看你发现了什么问题。
-
澄清一下,我希望使用 Google 的 CloudBuild 进程本身将映像推送到 AWS 注册表
标签: google-cloud-build amazon-ecr