Skip to content

Instantly share code, notes, and snippets.

@afoninsky
Created November 28, 2016 14:25
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 afoninsky/b4b2c8bcc835a3f90885ec83ae65ee58 to your computer and use it in GitHub Desktop.
Save afoninsky/b4b2c8bcc835a3f90885ec83ae65ee58 to your computer and use it in GitHub Desktop.
GKE deploy image
#!/bin/bash
### run deployment from local machine (not CI)
docker info
if [ "$?" -ne "0" ]; then
exit
fi
REGISTRY_URL="us.gcr.io"
GOOGLE_PROJECT_NAME="spair-api"
NAME=`node -e "console.log(require('./package').name)"`
VERSION=${1:-v`node -e "console.log(require('./package').version)"`}
IMAGE_TAG=$REGISTRY_URL/$GOOGLE_PROJECT_NAME/$NAME:$VERSION
# perform quick tests
# yarn test
# build image and push it to google
echo "Building image $IMAGE_TAG"
docker build -t $IMAGE_TAG .
echo "Pushing image to remote registry"
gcloud docker push $IMAGE_TAG
# docker rmi $IMAGE_TAG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment