python-docs-samples/run/helloworld at main · GoogleCloudPlatform/python-docs-samples

Cloud Run Hello World Sample

This sample shows how to deploy a Hello World application to Cloud Run.

Run in Google Cloud

Build

  • Set an environment variable with your GCP Project ID:
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
gcloud builds submit --pack image=gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld

Run Locally

docker run --rm gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld

Test

Note: you may need to install pytest using pip install pytest.

Deploy

# Set an environment variable with your GCP Project ID
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>

# Deploy to Cloud Run
gcloud run deploy helloworld --source .

For more details on how to work with this sample read the Python Cloud Run Samples README