Build arm64 functions with OpenFaaS

Build arm64 functions with OpenFaaS

I've been taking a course on OpenFaaS with Kubernetes at edX by the Linux Foundation and it has been a great learning experience. My set-up for this has been to run VMs on the Raspberry Pi 4, which supports an arm64 based kernel.

Diving into kubernetes was really straightforward, and it was simple enough to spin up OpenFaaS with arkade. One of my initial complaints with OpenFaaS was the lack of examples for arm64 based systems. Most of their examples work with amd64/arm and others. Therefore, I decided to bake my own function containers for arm64.

To use the figlet function : https://hub.docker.com/r/oswalpalash/figlet
To use the SentimentAnalysis function : https://hub.docker.com/r/oswalpalash/sentimentalanalysis

Furthermore, the interesting part comes with creating new functions with the multi-arch templates provided by OpenFaaS. I had a hard time trying to get container builds going for arm64.

The solution :
To enable multi-arch builds with faas-cli, I installed docker buildx, which enables the support for --platform inputs during the builds. Once the plugin is installed, it can be enabled in the command-line by using : DOCKER_BUILDKIT=1 faas-cli build -f function.yml --no-cache --build-arg platform=linux/arm64/v8
Replace function.yml with the path to your function definiton.

Hope this helps!

Show Comments