为什么 Google Cloud Build 配置文件不使用 docker 构建步骤的入口点?
Why does the Google Cloud Build configuration file not use an entrypoint for docker build step(s)?
总的来说,我看到的云构建配置示例如下所示。为什么 cloud-sdk 构建步骤使用入口点,而 docker 构建步骤不使用入口点?
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--tag', 'gcr.io/project-id/project-name','.']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/project-id/project-name']
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
args: ['run', 'deploy', 'project-name', '--image', 'gcr.io/project-id/project-name', '--region', 'us-central1']
我的 运行ning 理论是它与 name
的最后一个词与 cmd
关键字参数相同。例如。 gcr.io/cloud-builders/docker
以 docker
结尾,但 cloud-sdk
需要 cmd
关键字 gcloud
到 运行。
Why does the cloud-sdk build step use an entrypoint when the docker build steps do not?
这是因为入口点 gcloud
将用于调用 gcloud run deploy
命令以将其部署在云端 运行。
另一方面,Dockerfile 有自己的开源配置,因此它可以在 gcloud 之外的其他平台上运行。
有关 args
和 entrypoint
的其他信息可在 Structure of a build config file 上的 link 中找到。
总的来说,我看到的云构建配置示例如下所示。为什么 cloud-sdk 构建步骤使用入口点,而 docker 构建步骤不使用入口点?
steps:
# Build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--tag', 'gcr.io/project-id/project-name','.']
# Push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'gcr.io/project-id/project-name']
# Deploy container image to Cloud Run
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
entrypoint: 'gcloud'
args: ['run', 'deploy', 'project-name', '--image', 'gcr.io/project-id/project-name', '--region', 'us-central1']
我的 运行ning 理论是它与 name
的最后一个词与 cmd
关键字参数相同。例如。 gcr.io/cloud-builders/docker
以 docker
结尾,但 cloud-sdk
需要 cmd
关键字 gcloud
到 运行。
Why does the cloud-sdk build step use an entrypoint when the docker build steps do not?
这是因为入口点 gcloud
将用于调用 gcloud run deploy
命令以将其部署在云端 运行。
另一方面,Dockerfile 有自己的开源配置,因此它可以在 gcloud 之外的其他平台上运行。
有关 args
和 entrypoint
的其他信息可在 Structure of a build config file 上的 link 中找到。