Dminor7 / cloud-run-test

Quickstart: setup and start developing(Python) for Cloud Run locally with function-framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Testing Cloud Run locally via Function Framework

Functions Framework for Python

An open source FaaS (Function as a service) framework for writing portable Python functions -- brought to you by the Google Cloud Functions team.

The Functions Framework lets you write lightweight functions that run in many different environments, including:

  • Google Cloud Functions
  • Your local development machine
  • Cloud Run and Cloud Run for Anthos
  • Knative-based environments

Quickstart: Hello, World on your local machine

def hello(request):
    return "Hello world!"

Quickstart: Build a Deployable Container

  1. Install Docker and the pack tool.

  2. Build a container from your function using the Functions buildpacks:

     bash sbin/build.sh
    
  3. Start the built container:

     bash sbin/run.sh
     # Output: Serving function...
    
  4. Send requests to this function using curl from another terminal window:

     curl localhost:8080
     # Output: Hello World!
    

About

Quickstart: setup and start developing(Python) for Cloud Run locally with function-framework


Languages

Language:Dockerfile 44.8%Language:Shell 34.8%Language:Python 20.5%