Cloud Run Hello World Sample

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

Run in Google Cloud

Build

docker build --tag helloworld:python .

Run Locally

docker run --rm -p 9090:8080 -e PORT=8080 helloworld:python

Test

pytest

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>

# Submit a build using Google Cloud Build
gcloud builds submit --tag gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld

# Deploy to Cloud Run
gcloud run deploy helloworld \
--image gcr.io/${GOOGLE_CLOUD_PROJECT}/helloworld

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