Skip to content

Instantly share code, notes, and snippets.

@Timtech4u
Created January 12, 2021 07:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Timtech4u/619f5e69e077cf9e4bdd0959881406bd to your computer and use it in GitHub Desktop.
Save Timtech4u/619f5e69e077cf9e4bdd0959881406bd to your computer and use it in GitHub Desktop.
Generic Cloud Build
steps:
# build and push container
- name: "gcr.io/kaniko-project/executor:latest"
args: ["--cache=true", "--cache-ttl=48h", "--destination=gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME"]
# deploy container image to Cloud Run with env vars
- name: "gcr.io/cloud-builders/gcloud"
args: ['run', 'deploy', '$REPO_NAME', '--image', 'gcr.io/$PROJECT_ID/$REPO_NAME:$BRANCH_NAME', '--region', 'europe-west4', '--allow-unauthenticated', '--platform', 'managed', '--update-env-vars', 'NODE_ENV=prod']
# set full traffic to latest revision (needed if rollback was performed)
- name: "gcr.io/cloud-builders/gcloud"
args: ['run', 'services', 'update-traffic', '$REPO_NAME', '--to-latest', '--region', 'europe-west4', '--platform', 'managed']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment