Skip to content

Commit 95d0b35

Browse files
authored
Improve documentation around Dockerfiles (#70)
* Add a link to an example Dockerfile in the top README.md * Update the inline Dockerfile to match file * Remove explicit gunicorn installation * make readme links absolute, useful Useful for when this readme appears on both github and pypi
1 parent 6f0d848 commit 95d0b35

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ After you've written your function, you can simply deploy it from your local mac
112112

113113
## Cloud Run/Cloud Run on GKE
114114

115-
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).
115+
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)
116116

117117
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).
118118

@@ -149,7 +149,7 @@ For more details on this signature type, check out the Google Cloud Functions do
149149

150150
# Advanced Examples
151151

152-
More advanced guides can be found in the [`examples/`](./examples/) directory.
152+
More advanced guides can be found in the [`examples/`](https://github.com/GoogleCloudPlatform/functions-framework-python/blob/master/examples/) directory.
153153

154154
# Contributing
155155

examples/cloud_run_http/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR $APP_HOME
88
COPY . .
99

1010
# Install production dependencies.
11-
RUN pip install gunicorn functions-framework
11+
RUN pip install functions-framework
1212
RUN pip install -r requirements.txt
1313

1414
# Run the web service on container startup.

examples/cloud_run_http/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,11 @@ WORKDIR $APP_HOME
2626
COPY . .
2727

2828
# Install production dependencies.
29-
RUN pip install gunicorn functions-framework
29+
RUN pip install functions-framework
3030
RUN pip install -r requirements.txt
3131

32-
# Run the web service on container startup. Here we use the gunicorn
33-
# webserver, with one worker process and 8 threads.
34-
# For environments with multiple CPU cores, increase the number of workers
35-
# to be equal to the cores available.
36-
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 -e FUNCTION_TARGET=hello functions_framework:app
32+
# Run the web service on container startup.
33+
CMD exec functions-framework --target=hello
3734
```
3835

3936
Start the container locally by running `docker build` and `docker run`:

0 commit comments

Comments
 (0)