GoogleCloudPlatform/functions-framework-php

Instructions for Cloud Run

Closed this issue · 3 comments

grant commented

In order to use this functions framework, there should be instructions on how to deploy this container to Cloud Run.

When I tested, I wasn't able use the example Dockerfile.

https://github.com/GoogleCloudPlatform/functions-framework-php/blob/master/examples/hello/Dockerfile

Expected

Here are example of guides for instructions for Cloud Run with other function frameworks:

I expected to find a similar guide for the PHP Functions Framework. This would be useful for all developers wishing to use this package with Google Cloud.

Example Section: Deploy a Container

You can deploy your containerized function to Cloud Run by following the Cloud Run quickstart.

Use the docker and gcloud CLIs to build and deploy a container to Cloud Run, replacing the project id $GOOGLE_CLOUD_PROJECT and image name php-ff:

docker build -t gcr.io/$GOOGLE_CLOUD_PROJECT/php-ff .
docker push gcr.io/$GOOGLE_CLOUD_PROJECT/php-ff
gcloud run deploy helloworld --image gcr.io/$GOOGLE_CLOUD_PROJECT/php-ff --region us-central1

If you want even more control over the environment, you can deploy your container image to Cloud Run on GKE. With Cloud Run on GKE, you can run your function on a GKE cluster, which gives you additional control over the environment (including use of GPU-based instances, longer timeouts and more).

Actual

There isn't a guide for deploying this to Cloud Run. The best guide is using Docker in the README.
Trying to deploy to Cloud Run fails for multiple reasons:

  • There isn't an example Dockerfile
  • There aren't instructions for deploying the GCP

@bshaffer have you been able to deploy this framework onto Cloud Run?

Yes, I was able to use the example Dockerfile to deploy to Cloud Run

grant commented

I'll provide more details as to the specific issues I was running into. Notes from chat:

  • provide a fix for the issue
  • provide errors that you encounter so I can advise what may have gone wrong

Added instructions for Cloud Run to the README:

#21

I'm closing this since the issue filed was for "Instructions for Cloud Run". If you find an issue with the current instructions/implementation, please open a new bug!