Files
2025-01-07 10:32:02 -08:00

39 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This is following part of [OpenFaaS tempalte Readme](https://github.com/clearlinux/dockerfiles/blob/master/FaaS/OpenFaaS/template/README.md).
This template is based on [clearlinux/python:3](https://hub.docker.com/r/clearlinux/python) container image. Python version is 3.8.
### python3-clearlinux
1. Create a function named hello-openfass
`faas-cli new --lang python3-clearlinux hello-openfaas --prefix="<your-docker-username-here>"`
Files tree as below.
>
├── hello-openfaas
│   ├── bundles.txt
│   ├── handler.py
│   ├── helper_script.sh
│   ├── __init__.py
│   └── requirements.txt
├── hello-openfaas.yml
└── template
* Put the required python packages in the "requirements.txt".
For example,
`echo "valkey" >> hello-openfaas/requirements.txt`
`echo "flask" >> hello-openfaas/requirements.txt`
* Put the required Clear Linux bundles in the "bundles.txt".
For example,
`echo "openblas" >> hello-openfaas/bundles.txt`
`echo "wget" >> hello-openfaas/bundles.txt`
* Put any initial/helper operation in the "help_script.sh"
2. Deploy function
`faas-cli up -f hello-openfaas.yml`
Then you can invoke your python function by OpenFaas UI or faas-cli.