spring-boot - 无法在应用引擎标准环境 (GCP) 中部署预构建映像
问题描述
我的 Spring Boot 应用程序在云构建和部署中运行良好,直到 9 月没有任何问题。现在我的触发器在 gcloud app deploy 中失败了。
第 4 步:错误:(gcloud.app.deploy)INVALID_ARGUMENT:部署不能使用预构建的映像。仅在 App Engine 柔性环境中允许使用预构建的图像。
应用程序.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"]
提前致谢。我很困惑我的构建之前是如何工作的以及我现在做错了什么。
解决方案
您不能在 App Engine 标准上部署自定义容器。您必须提供您的代码和环境运行时。然后Buildpack用于在 Google 端创建一个标准容器(作为参考,为此运行了一个新的 Cloud Build 作业)并部署在 App Engine 上。
我建议您查看 Cloud Run 以使用您的自定义容器。它非常接近 App Engine(在许多方面甚至更好!)并且非常可定制。
推荐阅读
- scala - 如何测试 akka-http 路由来处理异常?
- python - 你可以重新训练 RAKE 吗?
- javascript - 我无法停止执行功能
- emacs - 如果所有子 TODO 都已完成,如何归档组织模式 TODO 条目?
- java - 搜索从 @MappedSuperclass 扩展的所有表
- java - 映射 JPA Spring
- mysql - 列 'ip' 不能为空(SQL:插入到 `logins` (`ip`, `steamid`, `time`)
- java - 选择正确的资源包:JAVA SE 8
- python - 根据另一列python pandas的计数用一个填充列
- r - 如何根据R中的条件减去多列