Skip to content

Instantly share code, notes, and snippets.

@clsung
Created August 10, 2019 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clsung/515419cc977e3672c7f8bf5cb6609c89 to your computer and use it in GitHub Desktop.
Save clsung/515419cc977e3672c7f8bf5cb6609c89 to your computer and use it in GitHub Desktop.
Cloud Run deploy
#!/usr/bin/env bash
# gcloud config set project {PROJECTID}
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
HOSTNAME=asia.gcr.io
PROJECTID=${GCP_PROJECT}
IMAGE=${IMAGE_NAME}
TAG=`git rev-parse --short=7 HEAD`
cd "${DIR}/.."
docker build -t ${HOSTNAME}/${PROJECTID}/${IMAGE}:${TAG} -f deploy/Dockerfile .
if [[ ${?} != 0 ]]; then
# build error
exit $?
fi
docker push ${HOSTNAME}/${PROJECTID}/${IMAGE}:${TAG}
gcloud beta run deploy ${IMAGE} --project ${PROJECTID} --image ${HOSTNAME}/${PROJECTID}/${IMAGE}:${TAG} --region us-central1 --platform managed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment