Created
January 2, 2022 21:32
-
-
Save clarkmcc/d4594e7c0f852b4596ac52df28cf087b to your computer and use it in GitHub Desktop.
Builds, pushes, and deploys a container image to Google Cloud Run, just set the $PROJECT_NAME variable
This file contains hidden or 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/$PROJECT_ID/$PROJECT_NAME:$SHORT_SHA', '--cache-from', '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:$SHORT_SHA'] | |
# Deploy to Google Cloud Run | |
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' | |
entrypoint: gcloud | |
args: ['run', 'deploy', '$PROJECT_NAME', '--image', 'gcr.io/$PROJECT_ID/$PROJECT_NAME:$SHORT_SHA', '--region', 'us-west1', '--platform', 'managed'] | |
images: | |
- gcr.io/$PROJECT_ID/$PROJECT_NAME | |
timeout: 1200s | |
options: | |
machineType: N1_HIGHCPU_32 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment