您可以使用 Kaniko 通过 gcloud app deploy 为 App Engine Flexible 构建自定义映像吗?

Can you use Kaniko to build a custom image for App Engine Flexible with gcloud app deploy?

我目前正在使用 gcloud app deploy 为 App Engine Flexible 构建自定义映像。我已经尝试过使用 Kaniko 来为其他项目使用 gcloud builds submit 进行缓存,但是是否可以为使用 gcloud app deploy 提交的构建启用 Kaniko?

我试过 运行 gcloud config set builds/use_kaniko True,这似乎没有改变构建行为。

似乎一个选择是先通过 gcloud builds submit 构建映像,然后使用 gcloud app deploy --image-url=...,但我不确定是否有更简化的方法。

正如您在问题中已经说过的,一个好的方法是首先使用 Google Cloud Build 使用您的 Dockerfile 创建您自己的图像,然后在将您的应用程序部署到 Google 时使用它应用引擎。

在 Google Cloud Container Builder 中,您可以 运行 Kaniko,方法是将其添加为构建配置中的构建步骤:

steps:
 - name: gcr.io/kaniko-project/executor:latest
   args: ["--dockerfile=<path to Dockerfile>",
          "--context=<path to build context>",
          "--destination=<gcr.io/[PROJECT]/[IMAGE]:[TAG]>"]

可以在这两篇关于 Google Cloud 和 kaniko 的博文中找到更多信息。 Post 1 & 2.

之后,您可以通过在 gcloud 命令中指定 --image-url flag 来部署您的应用程序:

gcloud app deploy --image-url=gcr.io/[PROJECT]/[IMAGE]:[TAG]