Created
June 22, 2019 02:24
-
-
Save Timtech4u/27715bb926b57dbf08d0e5fc0e4ae9bf to your computer and use it in GitHub Desktop.
Multi Staged Deployment with Cloud Build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
# build the container image | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['build', '-t', 'gcr.io/projectz-239507/app', '.'] | |
# push the container image to Container Registry | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['push', 'gcr.io/projectz-239507/app'] | |
# create database | |
- name: 'gcr.io/cloud-builders/gcloud' | |
args: ['sql', 'databases', 'create', 'mydb', '--instance', 'ddd'] | |
# create cloud bucket | |
- name: 'gcr.io/cloud-builders/gsutil' | |
args: ['mb', '-l', 'us-central1', 'gs://mybucket'] | |
# Deploy container image to Cloud Run | |
- name: 'gcr.io/cloud-builders/gcloud' | |
args: ['beta', 'run', 'deploy', 'app', '--image', 'gcr.io/projectz-239507/app', '--region', 'us-central1', '--allow-unauthenticated', '--update-env-vars', 'BUCKET=mybucket, DATABASE=mydb'] | |
images: | |
- gcr.io/projectz-239507/app | |
timeout: 1200s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment