From 95630f5c9a7fa8896e798e7c209e8aee334f5e82 Mon Sep 17 00:00:00 2001 From: Mohammed Rabil Date: Wed, 17 Apr 2024 10:16:58 +0530 Subject: [PATCH] Add Cloud Build configuration for deploying to Cloud Run --- cloudbuild.yaml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 cloudbuild.yaml diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000..bc64c17 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,49 @@ +steps: + - name: gcr.io/cloud-builders/docker + args: + - build + - '--no-cache' + - '-t' + - >- + $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA + - . + - '-f' + - Dockerfile + id: Build + - name: gcr.io/cloud-builders/docker + args: + - push + - >- + $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA + id: Push + - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim' + args: + - run + - services + - update + - $_SERVICE_NAME + - '--platform=managed' + - >- + --image=$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA + - >- + --labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID + - '--region=$_DEPLOY_REGION' + - '--quiet' + id: Deploy + entrypoint: gcloud +images: + - >- + $_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA +options: + substitutionOption: ALLOW_LOOSE + logging: CLOUD_LOGGING_ONLY +substitutions: + _DEPLOY_REGION: asia-south1 + _AR_HOSTNAME: asia-south1-docker.pkg.dev + _PLATFORM: managed + _TRIGGER_ID: 6f098bc3-ca01-452c-99b1-29b3f2519243 + _SERVICE_NAME: tiara-test-web +tags: + - gcp-cloud-build-deploy-cloud-run + - gcp-cloud-build-deploy-cloud-run-managed + - tiara-test-web