Skip to content

Instantly share code, notes, and snippets.

@bharatmicrosystems
Created April 27, 2020 15:11
Show Gist options
  • Save bharatmicrosystems/b107357560e2c4317756fac79814d42c to your computer and use it in GitHub Desktop.
Save bharatmicrosystems/b107357560e2c4317756fac79814d42c to your computer and use it in GitHub Desktop.
steps:
# Pull the existing image
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/$PROJECT_ID/tomcat:latest || exit 0
# Build a docker image
- name: 'gcr.io/cloud-builders/docker'
args: [ 'build', '-t', 'gcr.io/$PROJECT_ID/tomcat', '--cache-from', 'gcr.io/$PROJECT_ID/tomcat', '.' ]
# Push the docker image to container registry
- name: 'gcr.io/cloud-builders/docker'
args: ["push", "gcr.io/$PROJECT_ID/tomcat"]
# Deploy an image from Container Registry to Cloud Run
- name: 'gcr.io/cloud-builders/gcloud'
args: ['beta', 'run', 'deploy', 'tomcat', '--image', 'gcr.io/$PROJECT_ID/tomcat:latest', '--region', 'europe-west1', '--platform', 'managed', '--allow-unauthenticated']
images:
- 'gcr.io/$PROJECT_ID/tomcat'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment