diff --git a/FaaS/OpenFaaS/template/README.md b/FaaS/OpenFaaS/template/README.md index 656b950..14685de 100644 --- a/FaaS/OpenFaaS/template/README.md +++ b/FaaS/OpenFaaS/template/README.md @@ -72,6 +72,7 @@ Steps could refer to ├── hello-openfaas │   ├── bundles.txt │   ├── handler.py + │   ├── helper_script.sh │   ├── __init__.py │   └── requirements.txt ├── hello-openfaas.yml @@ -89,6 +90,10 @@ Steps could refer to `echo "openblas" >> hello-openfaas/bundles.txt` `echo "wget" >> hello-openfaas/bundles.txt` + + * Put any initial/helper operation in the "help_script.sh" + + 4. `faas-cli up -f hello-openfaas.yml` Then you can invoke your python function by OpenFaas UI or faas-cli. diff --git a/FaaS/OpenFaaS/template/python3-clearlinux/Dockerfile b/FaaS/OpenFaaS/template/python3-clearlinux/Dockerfile index a40be1e..58dabcc 100644 --- a/FaaS/OpenFaaS/template/python3-clearlinux/Dockerfile +++ b/FaaS/OpenFaaS/template/python3-clearlinux/Dockerfile @@ -35,6 +35,10 @@ RUN for bundle in $(cat bundles.txt); do \ swupd bundle-add $bundle $swupd_args; \ done +# give a chance to run help script +COPY function/helper_script.sh . +RUN chmod +x helper_script.sh && ./helper_script.sh + WORKDIR /root/ COPY function function diff --git a/FaaS/OpenFaaS/template/python3-clearlinux/function/helper_script.sh b/FaaS/OpenFaaS/template/python3-clearlinux/function/helper_script.sh new file mode 100644 index 0000000..a9bf588 --- /dev/null +++ b/FaaS/OpenFaaS/template/python3-clearlinux/function/helper_script.sh @@ -0,0 +1 @@ +#!/bin/bash