Skip to content

Commit b029055

Browse files
glasntdi
authored andcommitted
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 f2471b4 commit b029055

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

README.md

Lines changed: 3 additions & 3 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

@@ -178,8 +178,8 @@ See the [running example](examples/cloud_run_cloudevents).
178178

179179
# Advanced Examples
180180

181-
More advanced guides can be found in the [`examples/`](./examples/) directory. You can also find examples
182-
on using the CloudEvent Python SDK [here](https://github.com/cloudevents/sdk-python).
181+
More advanced guides can be found in the [`examples/`](https://github.com/GoogleCloudPlatform/functions-framework-python/blob/master/examples/) directory.
182+
You can also find examples on using the CloudEvent Python SDK [here](https://github.com/cloudevents/sdk-python).
183183

184184
# Contributing
185185

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)