Created
August 10, 2019 01:54
-
-
Save clsung/515419cc977e3672c7f8bf5cb6609c89 to your computer and use it in GitHub Desktop.
Cloud Run deploy
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
#!/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