Google App Engine Python应用从GCR迁移至Artifact Registry是否可行
在Google App Engine标准环境中配置Artifact Registry存储Docker镜像
可以明确地说,完全支持将Google Artifact Registry作为Docker镜像的存储来替代即将弃用的GCR,且Google官方已在推动这一迁移,适配GAE标准环境的部署流程。
具体配置方式如下:
- 先在与你的GAE应用同区域的位置,创建一个Artifact Registry的Docker类型仓库。
- 部署时显式指定Artifact Registry的镜像地址:
gcloud app deploy --image-url=LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/IMAGE:TAG - 若想避免每次部署都输入参数,可设置默认的Artifact Registry仓库:
# 设置默认仓库 gcloud config set app/artifact_registry_repository REPOSITORY # 设置对应区域 gcloud config set app/region LOCATION - 确保CI流程使用的服务账号拥有Artifact Registry的读写权限,比如授予
roles/artifactregistry.writer角色。
另外需要注意,对于新创建的GAE应用,gcloud app deploy默认会使用Artifact Registry;对于存量应用,手动配置上述参数后即可完成切换,无需修改应用代码。
内容的提问来源于stack exchange,提问作者anderson
相关产品推荐
相关产品推荐

