Created
February 17, 2021 21:42
-
-
Save sohiniroych/f9775a564a9b80f48efcab6e99d35313 to your computer and use it in GitHub Desktop.
YAML file
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: | |
| # pull the container image if it is already built | |
| - name: 'gcr.io/cloud-builders/docker' | |
| entrypoint: 'bash' | |
| args: | |
| - '-c' | |
| - 'docker pull gcr.io/$PROJECT_ID/appcicd:latest || exit 0' | |
| # build the container image | |
| - name: 'gcr.io/cloud-builders/docker' | |
| args: | |
| - 'build' | |
| - '-t' | |
| - 'gcr.io/$PROJECT_ID/appcicd:latest' | |
| - '-t' | |
| - 'gcr.io/$PROJECT_ID/appcicd:$COMMIT_SHA' | |
| - '--cache-from' | |
| - 'gcr.io/$PROJECT_ID/appcicd:latest' | |
| - '.' | |
| # push the container image to Container Registry with all tags | |
| - name: 'gcr.io/cloud-builders/docker' | |
| args: | |
| - 'push' | |
| - 'gcr.io/$PROJECT_ID/appcicd' | |
| # deploy container image to Cloud Run | |
| - name: 'gcr.io/cloud-builders/gcloud' | |
| args: | |
| - 'run' | |
| - 'deploy' | |
| - 'flaskappml' | |
| - '--image' | |
| - 'gcr.io/$PROJECT_ID/appcicd:latest' | |
| - '--region' | |
| - 'us-central1' | |
| - '--platform' | |
| - 'managed' | |
| - '--allow-unauthenticated' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment