From b54d062459e71e55c8ecd7ae01e3d016221c1b93 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Wed, 15 Jul 2020 13:25:58 +1000 Subject: [PATCH 1/4] Add a link to an example Dockerfile in the top README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 11c01c14..945e7060 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ After you've written your function, you can simply deploy it from your local mac ## Cloud Run/Cloud Run on GKE -Once you've written your function and added the Functions Framework to your `requirements.txt` file, all that's left is to create a container image. [Check out the Cloud Run quickstart](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) for Python to create a container image and deploy it to Cloud Run. You'll write a `Dockerfile` when you build your container. This `Dockerfile` allows you to specify exactly what goes into your container (including custom binaries, a specific operating system, and more). +Once you've written your function and added the Functions Framework to your `requirements.txt` file, all that's left is to create a container image. [Check out the Cloud Run quickstart](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) for Python to create a container image and deploy it to Cloud Run. You'll write a `Dockerfile` when you build your container. This `Dockerfile` allows you to specify exactly what goes into your container (including custom binaries, a specific operating system, and more). [Here is an example `Dockerfile` that calls Functions Framework.](./examples/cloud_run_http/Dockerfile) If you want even more control over the environment, you can [deploy your container image to Cloud Run on GKE](https://cloud.google.com/run/docs/quickstarts/prebuilt-deploy-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). From 481597491ecfd79a68ff18942603460ce9bec467 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Wed, 15 Jul 2020 13:26:12 +1000 Subject: [PATCH 2/4] Update the inline Dockerfile to match file --- examples/cloud_run_http/README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/cloud_run_http/README.md b/examples/cloud_run_http/README.md index 6cf53980..0a3ab56b 100644 --- a/examples/cloud_run_http/README.md +++ b/examples/cloud_run_http/README.md @@ -29,11 +29,8 @@ COPY . . RUN pip install gunicorn functions-framework RUN pip install -r requirements.txt -# Run the web service on container startup. Here we use the gunicorn -# webserver, with one worker process and 8 threads. -# For environments with multiple CPU cores, increase the number of workers -# to be equal to the cores available. -CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 -e FUNCTION_TARGET=hello functions_framework:app +# Run the web service on container startup. +CMD exec functions-framework --target=hello ``` Start the container locally by running `docker build` and `docker run`: From fc92f94e4382880c5f5ed306288292f0d3397f02 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 16 Jul 2020 08:25:49 +1000 Subject: [PATCH 3/4] Remove explicit gunicorn installation --- examples/cloud_run_http/Dockerfile | 2 +- examples/cloud_run_http/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/cloud_run_http/Dockerfile b/examples/cloud_run_http/Dockerfile index e8ab5287..c81596c3 100644 --- a/examples/cloud_run_http/Dockerfile +++ b/examples/cloud_run_http/Dockerfile @@ -8,7 +8,7 @@ WORKDIR $APP_HOME COPY . . # Install production dependencies. -RUN pip install gunicorn functions-framework +RUN pip install functions-framework RUN pip install -r requirements.txt # Run the web service on container startup. diff --git a/examples/cloud_run_http/README.md b/examples/cloud_run_http/README.md index 0a3ab56b..4cbe96d4 100644 --- a/examples/cloud_run_http/README.md +++ b/examples/cloud_run_http/README.md @@ -26,7 +26,7 @@ WORKDIR $APP_HOME COPY . . # Install production dependencies. -RUN pip install gunicorn functions-framework +RUN pip install functions-framework RUN pip install -r requirements.txt # Run the web service on container startup. From 74c476dcb8de9e9a48b51fa55b8974768b66b606 Mon Sep 17 00:00:00 2001 From: Katie McLaughlin Date: Thu, 16 Jul 2020 09:37:01 +1000 Subject: [PATCH 4/4] make readme links absolute, useful Useful for when this readme appears on both github and pypi --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 945e7060..863a9e54 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ After you've written your function, you can simply deploy it from your local mac ## Cloud Run/Cloud Run on GKE -Once you've written your function and added the Functions Framework to your `requirements.txt` file, all that's left is to create a container image. [Check out the Cloud Run quickstart](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) for Python to create a container image and deploy it to Cloud Run. You'll write a `Dockerfile` when you build your container. This `Dockerfile` allows you to specify exactly what goes into your container (including custom binaries, a specific operating system, and more). [Here is an example `Dockerfile` that calls Functions Framework.](./examples/cloud_run_http/Dockerfile) +Once you've written your function and added the Functions Framework to your `requirements.txt` file, all that's left is to create a container image. [Check out the Cloud Run quickstart](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) for Python to create a container image and deploy it to Cloud Run. You'll write a `Dockerfile` when you build your container. This `Dockerfile` allows you to specify exactly what goes into your container (including custom binaries, a specific operating system, and more). [Here is an example `Dockerfile` that calls Functions Framework.](https://github.com/GoogleCloudPlatform/functions-framework-python/blob/master/examples/cloud_run_http) If you want even more control over the environment, you can [deploy your container image to Cloud Run on GKE](https://cloud.google.com/run/docs/quickstarts/prebuilt-deploy-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). @@ -149,7 +149,7 @@ For more details on this signature type, check out the Google Cloud Functions do # Advanced Examples -More advanced guides can be found in the [`examples/`](./examples/) directory. +More advanced guides can be found in the [`examples/`](https://github.com/GoogleCloudPlatform/functions-framework-python/blob/master/examples/) directory. # Contributing