Current pricing data can be found here.
Google Cloud Build uses a file, cloudbuild.yml
, to define the tasks that will
be executed when a build is triggered.
The online references for the syntax are pretty good:
Below are some example configuration files used for this site.
Cloud Build is great for keeping your Docker Registry images aligned with your version control code.
In this example I use Cloud Build to build and push a pelican image to the Google Container Registry.
Be sure to keep the Dockerfile code in version control. Aside from being a good idea in general, Cloud Build can also use Git commits as a build trigger. Here's my Pelican Docker image repository.
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/pelican', '.' ]
images:
- 'gcr.io/$PROJECT_ID/pelican'
Another use for Cloud Builder is to generate static website files and then sync them up with Cloud Storage every time the source control files or template are changed.
Here's an example that triggers when I commit code to my
blog content git repository. It
copies the content into /workspace
and uses the above pelican image to render
the content and output it to the output/
directory.
Once the site content is generated, the next step uses the gcloud
image's
gsutil -m rsync
command to upload the files to the Google Storage Bucket.
Here's the procedure I used to link a Cloud Build trigger to my Pelican image.
Push to master branch
Branch
master
cloudbuild.yaml
With this trigger in place, all pushes to the pelican project will trigger the rebuilding of its image, followed by updating the image in GCR with the latest changes.