This example will show you how to test and deploy Python3 code to IronFunctions.
At func.yaml you will find:
name: USERNAME/hellopy3
version: 0.0.1
path: /hellopy3
build:
- docker run --rm -v "$PWD":/worker -w /worker iron/python:3-dev pip install -t packages -r requirements.txt
The important step here is to ensure you replace USERNAME with your Docker Hub account name. Some points of note:
the application name is python3app and the route for incoming requests is /hellopy3. These informations are relevant for
the moment you try to test this function.
# build the function
fn build
# test it
cat hello.payload.json | fn run
# push it to Docker Hub
fn push
# Create a route to this function on IronFunctions
fn routes create python3app /hellopy3-v is optional, but it allows you to see how this function is being built.
Now you can start jobs on your function. Let's quickly queue up a job to try it out.
cat hello.payload.json | fn call python3app /hellopy3Here's a curl example to show how easy it is to do in any language:
curl -H "Content-Type: application/json" -X POST -d @hello.payload.json http://localhost:8080/r/python3app/hellopy3