Skip to content

Commit fd62ab5

Browse files
authored
Merge pull request #81 from PromiseFru/main
update: added instructions on how to run samples/hello-world-python l…
2 parents 3c6e8f7 + 773d7fd commit fd62ab5

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

  • functions/knative/hello-world-python

functions/knative/hello-world-python/README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,28 @@
55
1. [Install OpenFunction](https://github.com/OpenFunction/OpenFunction#install-openfunction)
66
2. [Refer to the go function sample](../hello-world-go/README.md)
77

8-
Definition of a ```Function``` for ```python``` is shown below:
8+
## Run it locally
9+
10+
Build the function locally
11+
12+
```sh
13+
pack build python-sample --builder openfunction/gcp-builder:v1 --env GOOGLE_FUNCTION_TARGET=hello_world
14+
```
15+
16+
Run the function
17+
18+
```sh
19+
docker run --rm --env="FUNC_CONTEXT={\"name\":\"python-sample\",\"version\":\"v1.0.0\",\"port\":\"8080\",\"runtime\":\"Knative\"}" --env="CONTEXT_MODE=self-host" --name python-sample -p 8080:8080 python-sample
20+
```
21+
22+
Send a request
23+
24+
```sh
25+
curl http://localhost:8080
26+
# hello, world
27+
```
28+
29+
Definition of a `Function` for `python` is shown below:
930

1031
```yaml
1132
apiVersion: core.openfunction.io/v1beta1
@@ -35,4 +56,3 @@ spec:
3556
- name: function
3657
imagePullPolicy: Always
3758
```
38-

0 commit comments

Comments
 (0)