【问题标题】:Unable to deploy pre built image in app engine standard environment (GCP)无法在应用引擎标准环境 (GCP) 中部署预构建映像
【发布时间】:2021-02-08 17:30:03
【问题描述】:

我的 Spring Boot 应用程序在云构建和部署中运行良好,直到 9 月没有任何问题。 现在我的触发器在 gcloud 应用部署中失败了。

第 4 步:错误:(gcloud.app.deploy) INVALID_ARGUMENT:部署无法使用预构建的映像。预构建的图片只能在 App Engine 柔性环境中使用。

app.yaml

runtime: java11
env: standard
service: service
handlers:
  - url: /.*
    script: this field is required, but ignored

cloudbuild.yaml

steps:
# backend deployment
# Step 1:
  - name: maven:3-jdk-14
    entrypoint: mvn
    dir: 'service'
    args: ["test"]

# Step 2:
  - name: maven:3-jdk-14
    entrypoint: mvn
    dir: 'service'
    args: ["clean", "install", "-Dmaven.test.skip=true"]

# Step 3:
  - name: docker
    dir: 'service'
    args: ["build", "-t", "gcr.io/service-base/base", "."]

# Step 4:
  - name: "gcr.io/cloud-builders/docker"
    args: ["push", "gcr.io/service-base/base"]

# Step 5:
  - name: 'gcr.io/cloud-builders/gcloud'
    dir: 'service/src/main/appengine'
    args: ['app', 'deploy', "--image-url=gcr.io/service-base/base"]
    timeout: "30m0s"
# Step 6:
  # dispatch.yaml deployment
  - name: "gcr.io/cloud-builders/gcloud"
    dir: 'service/src/main/appengine'
    args: ["app", "deploy", "dispatch.yaml"]
    timeout: "30m0s"
timeout: "100m0s"
images: ["gcr.io/service-base/base"]

Cloud build error

提前致谢。我很困惑我的构建之前是如何正常工作的以及我现在做错了什么。

【问题讨论】:

    标签: spring-boot google-app-engine google-cloud-platform gcloud


    【解决方案1】:

    您的cloudbuild.yaml 评论所指的Step 5 对应于错误中的Step #4,因为系统从0 开始编号步骤。

    错误信息是准确的; App Engine 标准 (!) 与 App Engine 灵活的不同之处在于后者(灵活)允许容器映像部署。 App Engine 标准 deploys 来自来源。

    请参阅 Google 的 example

    可能是某些事情改变了导致问题的 Google 方面,但您的 app.yaml 中的 env: standard 表明构建文件已更改。

    【讨论】:

      【解决方案2】:

      您不能在 App Engine 标准上部署自定义容器。您必须提供您的代码和环境运行时。然后Buildpack 用于在 Google 端创建一个标准容器(有关信息,为此运行了一个新的 Cloud Build 作业)并部署在 App Engine 上。

      我建议您查看 Cloud Run 以使用您的自定义容器。它非常接近 App Engine(在许多方面甚至更好!)并且非常可定制。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-06-22
        • 1970-01-01
        • 2019-05-11
        • 2018-04-29
        • 1970-01-01
        • 1970-01-01
        • 2019-03-12
        • 2023-03-04
        相关资源
        最近更新 更多