POC of a FaaS build tool to create knative services starting from functions
Look at https://github.com/containers/buildah/blob/master/install.md for dep dependency installation
make build
make install
Try to deploy example-fn.js
./kfn run fn.js
To build the image, run:
make image
To run kfn image (assuming in your workdir you have a directory mycontainer
and the function in the directory fn
):
podman run --net=host --security-opt label=disable --security-opt seccomp=unconfined --privileged --device /dev/fuse:rw -v $(pwd)/mycontainer:/var/lib/containers:Z -v "./fn:/home" kfn --verbose run /home/example-fn.js
kfn init
: Init a function in the working directorykfn clean [function]
orkfn clean --global
: Clean target directory of specified function or all.kfn
directorykfn edit [function] [editor]
: Edit the function with the specified editorkfn build
: Build the specified function and push to the specified registrykfn run
: Build, push and run the specified function
To add dependencies, add a comment:
// kfn:dependency primal 0.2.3
Kfn will add the dependency in the specific build manifest
For Rust, you'll need musl libc and the corresponding target for rustc. This target is required to static link the libc, reducing the effective image size to just the required libraries.
You can install the target with rustup:
rustup target add x86_64-unknown-linux-musl
To speedup during the development the cargo profile from release to debug, add this comment in your function:
// kfn:build-dev true
If you want to speedup the compilation across various functions, you can use sccache. To enable it when you compile your functions, add the comment:
// kfn:build-env RUSTC_WRAPPER=sccache