Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Latest commit

 

History

History
40 lines (28 loc) · 1.89 KB

DEPLOYING.md

File metadata and controls

40 lines (28 loc) · 1.89 KB

Deploying

⚠️ Following builder release 0.4.3, this project is deprecated and will no longer be officially maintained by VMware. Users should not use this project, builder, buildpacks, invokers, or application accelerator counterparts anymore.

Building your function

You can build your function using our provided builder, which already includes buildpacks and an invoker layer:

pack build my-function --path . --builder ghcr.io/vmware-tanzu/function-buildpacks-for-knative/functions-builder:0.4.3  --env BP_FUNCTION=path.function --env BP_JVM_VERSION=17

Where:

  • my-function is the name of your runnable function image, later used by Docker.
  • path is the name of the file or package where the function resides.
  • function is the name of the method or function.

Examples:

  • Python: BP_FUNCTION=func.main. func is the name of the .py file. main is the method.
  • Java: BP_FUNCTION=function.Handler. function the package. Handler is the class that implements Function.

Note: The invoker layer for Java functions utilizes Spring 3.0 which requires Java 17+. Add --env BP_JVM_VERSION=17 to your pack build command to influence the buildpacks to add JRE version 17 to your resulting image instead of the default version 11.

Local Deployment

Docker

This assumes you have Docker Desktop properly installed and running.

With Docker Desktop running, authenticated, and the ports (default 8080) available:

docker run -it --rm -p 8080:8080 my-function

Testing

After deploying your function, you can interact with our templates by doing:

  • Single function definition: curl -X POST localhost:8080
  • Multiple function definitions: curl -H "Content-Type: application/json" -X POST localhost:8080/hello
    • where hello as a path invokes your function's definition

With our templates, you should see some HTML or sample text returned indicating a success.