Last active
January 19, 2021 17:48
-
-
Save ashmore11/501cfc070a427508dbbf783fabf89a82 to your computer and use it in GitHub Desktop.
Next Strapi Cloud Run (pipelines deploy cms)
This file contains 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
#! /bin/bash | |
echo "" | |
echo "Building and deploying the CMS..." | |
cd cms || exit | |
image="eu.gcr.io/$GCLOUD_PROJECT_ID/$BITBUCKET_DEPLOYMENT_ENVIRONMENT" | |
existing_tags=$(gcloud container images list-tags --filter="tags:cms" --format=json "$image") | |
if [[ "$existing_tags" == "[]" ]]; then | |
docker build . --tag "$image:cms" | |
else | |
docker pull "$image:cms" | |
docker build . --tag "$image:cms" --cache-from "$image:cms" | |
fi | |
docker push "$image:cms" | |
gcloud run deploy "$GCLOUD_PROJECT_ID-cms" \ | |
--image "$image:cms" \ | |
--platform managed \ | |
--region "$GCP_REGION" \ | |
--update-env-vars DB_NAME="$DB_NAME",DB_SOCKET_PATH="$DB_SOCKET_PATH",DB_USERNAME="$DB_USERNAME",DB_PASSWORD="$DB_PASSWORD" | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment