Last active
June 28, 2018 07:47
-
-
Save aerobless/d3704fc202e92a45ea9da2ca85402a38 to your computer and use it in GitHub Desktop.
Deploy a Google Cloud Function
This file contains hidden or 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 | |
set -e | |
# Any real application probably has a more elaborate deployment process. Here I | |
# simply hardcoded my example function name; the first thing to change would be | |
# to load this from a configuration file or similar source instead. | |
PROJ=jso-camp | |
REGION=europe-west1 | |
# GCF has several ways to deploy. The path that makes the most sense using a | |
# build process is to deploy from local files. When deploying from local files, | |
# you need a Google cloud bucket to store the deployables. I created one (whose | |
# name is below) in the same example project. You will need to create your own | |
# bucket (easily done in the Google cloud web console for your project to put | |
# your deployables in). | |
BUCKET=kickerbox-storage | |
# One current weak point of GCF is that each function must be deployed | |
# separately. A real application making significant use of GCF will likely | |
# several functions, currently there is no way to deploy them jointly, | |
# transactionally, or quickly. | |
FNAME=api | |
gcloud beta functions deploy $FNAME --region $REGION --stage-bucket $BUCKET --project $PROJ --trigger-http | |
# Upon success, it will print the URL. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment