Skip to content

Instantly share code, notes, and snippets.

@Sunnepah
Last active February 27, 2021 20:13
Show Gist options
  • Save Sunnepah/2a1514a23c66230a81c391aab1cf2be6 to your computer and use it in GitHub Desktop.
Save Sunnepah/2a1514a23c66230a81c391aab1cf2be6 to your computer and use it in GitHub Desktop.
Google Cloudbuild.yaml to build, push image to gcr and deploy to cloud run service
steps:
# build the container image
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', 'eu.gcr.io/[google-cloud-yourproject]/[app-name]:latest', '.'] # change eu.gcr.io to your region
# push the container image to Container Registry
- name: 'gcr.io/cloud-builders/docker'
args: ['push', 'eu.gcr.io/[google-cloud-yourproject]/[app-name]:latest']
# Deploy container image to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args: ['beta', 'run', 'deploy', '[cloudrun-service-name]', '--image', 'eu.gcr.io/[google-cloud-yourproject]/[app-name]:latest', '--region', '[europe-west1]', '--platform', 'managed']
images:
- "eu.gcr.io/[google-cloud-yourproject]/[app-name]:latest"
options:
machineType: 'N1_HIGHCPU_8'
timeout: 900s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment