Deploying Cloud Functions
There are a number of ways to deploy Cloud Functions. We've already covered the one method: using the Cloud Console inline editor. This method is simple and straightforward, but it doesn't hold water in terms of release engineering. For real-world applications, there are a few better alternatives:
- Deploying from a GCS bucket
- Deploying from a local filesystem
- Deploying from a Google Cloud Source Repository
All three methods can be done using the gcloud beta functions deploy
command. This command takes an optional --source
argument, which accepts a GCS bucket path, a Cloud Source Repository, or a local filesystem path.
Deploying from a local machine
When deploying from a local filesystem, gcloud
will first bundle the included files and push them to a staging bucket in GCS. The staging bucket to use can be specified by providing the optional --stage-bucket
argument. Once in the staging bucket, the process for deployment is similar to that of deploying directly from a GCS...