Deploy a GCP Cloud Function from Github

Updated November 29, 2022
Created June 30, 2020


Create a github directory and add the following:

  1. The build spec ./cloudbuild.yaml

    steps:
      - name: "gcr.io/cloud-builders/gcloud"
        args:
          - functions
          - deploy
          - [function_name]
          - --source=.
          - --region=europe-west1
          - --entry-point=main
          - --trigger-http
          - --runtime=python37
          - --allow-unauthenticated
    
  2. Function ./main.py

    def main ():
        return "hello"
    
  3. Add a trigger to GCP

Done!


Comments?