Skip to content

Instantly share code, notes, and snippets.

@ashmore11
Last active January 19, 2021 17:48
Show Gist options
  • Save ashmore11/501cfc070a427508dbbf783fabf89a82 to your computer and use it in GitHub Desktop.
Save ashmore11/501cfc070a427508dbbf783fabf89a82 to your computer and use it in GitHub Desktop.
Next Strapi Cloud Run (pipelines deploy cms)
#! /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