[英]Google cloud build - custom machine type
I'm using Google cloud build to create images of my application.我正在使用谷歌云构建来创建我的应用程序的图像。 I created a build
trigger
that looking for git tag
in a specific format.我创建了一个构建
trigger
,以特定格式查找 git tag
。 Each time that the cloud-build detects a new tag - new build born.每次云构建检测到一个新标签 - 新构建诞生。
Since the build time is pretty long, I trying to make it faster.由于构建时间很长,我试图让它更快。
I found that it's possible to ask Google to build the application on a stronger machine ( Source ).我发现可以要求 Google 在更强大的机器( Source )上构建应用程序。
gcloud builds submit --config=cloudbuild.yaml --machine-type=n1-highcpu-8 .
But this code works if you choose the manual build option.但是,如果您选择手动构建选项,则此代码有效。 Since I'm created the build trigger from the GCP user interface, I can't find any place to fill the
machine-type
argument in there.由于我是从 GCP 用户界面创建的构建触发器,因此我找不到任何地方可以在其中填充
machine-type
参数。
How to choose machine-type
for users who have automatic build triggers?有自动构建触发器的用户如何选择
machine-type
?
In the Trigger
window, I choose Build Configuration
= Docker File
and this is my docker file preview:在
Trigger
window 中,我选择Build Configuration
= Docker File
,这是我的 docker 文件预览:
docker build \
-t gcr.io/PROJ_NAME/APP_NAME/$TAG_NAME:$COMMIT_SHA \
-f deployments/docker/APPNAME.docker \
.
How should look like my buildconfig.yaml
file?我的
buildconfig.yaml
文件应该如何?
You need to change to Build Configuration= Cloud Build configuration file
, and commit the cloudbuild.yaml
to git.您需要更改为 Build Configuration=
Cloud Build configuration file
,并将cloudbuild.yaml
提交到 git。
Then use the machineType
field in the options
property of your cloudbuild.yaml
file.然后使用您的
cloudbuild.yaml
文件的options
属性中的machineType
字段。
Eg例如
steps:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'gcr.io/PROJ_NAME/APP_NAME/$TAG_NAME:$COMMIT_SHA', '-f', 'deployments/docker/APPNAME.docker', '.']
options:
machineType: 'N1_HIGHCPU_8'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.