You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2024-08-13-building-functions-via-api-golang.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ hide_header_image: true
16
16
17
17
In this blog post I'll show you how to build functions using the new `builder` package for the [Go SDK](https://github.com/openfaas/go-sdk) for OpenFaaS.
18
18
19
-
You can use the [builder package](https://pkg.go.dev/github.com/openfaas/go-sdk/builder) to access the the Function Builder API, which takes source code and builds container images without needing root or Docker. It's designed for SaaS companies who want their users to be able to supply their own code to integrate into their product. It can also be used by a platform or managed services team that manages a multi-tenant OpenFaaS environment.
19
+
You can use the [builder package](https://pkg.go.dev/github.com/openfaas/go-sdk/builder) to access the Function Builder API, which takes source code and builds container images without needing root or Docker. It's designed for SaaS companies who want their users to be able to supply their own code to integrate into their product. It can also be used by a platform or managed services team that manages a multi-tenant OpenFaaS environment.
20
20
21
21
Since the Function Builder API has been available, we've mainly seen customers create a user-experience that resembles AWS Lambda, but for their own users. Users open a dashboard hosting a web IDE like Ace, CodeMirror or Monaco and supply code, it's then built and deployed to OpenFaaS via a single click.
22
22
@@ -86,7 +86,7 @@ Templates can be shared with the community, or kept private within an organizati
86
86
87
87
## Complete example with Go SDK
88
88
89
-
The Function Builder API takes a Docker build context as an input, and returns the URL to a published image, along with the logs as the result. It can run as non-root, and does not require Docker to be installed. The feature is available in OpenFaaS for Enterprises and is deployed via [separate Helm chart](https://github.com/openfaas/faas-netes/tree/master/chart/pro-builder).
89
+
The Function Builder API takes a Docker build context as an input, and returns the URL to a published image, along with the logs from the container builder. It can run as non-root, and does not require Docker to be installed. The feature is available in OpenFaaS for Enterprises and is deployed via [separate Helm chart](https://github.com/openfaas/faas-netes/tree/master/chart/pro-builder).
90
90
91
91
You can read how the Function Builder API works in the [OpenFaaS documentation](https://docs.openfaas.com/openfaas-pro/builder/), which also includes step-by-step examples using Bash, `curl`, and `tar` to show exactly how to prepare a bundle of source code and configuration for the builder.
92
92
@@ -206,7 +206,7 @@ The `builder.CreateBuildContext` call takes the `lang` variable which is the nam
206
206
207
207
The `faas-cli` is able to clone templates from a Git repository by looking up a JSON manifest file that indexes the various public templates, however you are likely going to have your own set of private templates.
208
208
209
-
You aren't limited to hosting your templates in a public Git repository like the official templates, you could do any of the following as examples:
209
+
You aren't limited to hosting your templates in a public Git repository like the official templates, you could do any of the following for example:
210
210
211
211
* Embedded in your application using Go's [`embed` package](https://pkg.go.dev/embed)
212
212
* Stored in a Git repository and cloned at build-time
@@ -267,7 +267,7 @@ The Function Builder API supports building images for multiple different CPU arc
267
267
268
268
It will increase build latency, waste CPU cycles and use up storage space, if you needlessly build multi-arch images. However, if your worker nodes are heterogeneous, or you want to support a wider range of devices for deployment, then multi-arch images make more sense. All the container images for the core OpenFaaS platform are built for both `linux/amd64` and `linux/arm64` to support Ampere Altra, AWS Graviton, and IoT devices like the Raspberry Pi,
269
269
270
-
64-Arm images be be built either on a `linux/arm64` node, or on a `linux/amd64` host using an emulation layer such as QEMU. Having dedicated Arm nodes for Arm builds requires additional resources, but is a much faster option than emulation. If you want to publish a multi-arch image in one shot, then you will have to endure emulation of at least one of the two build platforms.
270
+
64-Arm images can be built either on a `linux/arm64` node, or on a `linux/amd64` host using an emulation layer such as QEMU. Having dedicated Arm nodes for Arm builds requires additional resources, but is a much faster option than emulation. If you want to publish a multi-arch image in one shot, then you will have to endure emulation of at least one of the two build platforms.
271
271
272
272
And for a completely optimised build, you'll perform three builds. One `linux/amd64` build on `linux/amd64` hardware, one `linux/arm64` build on `linux/arm64` hardware, and then a final build which ties together the references into a single image manifest. Practically speaking, the third build can be optimised away by using a Go container library such as [github.com/google/go-containerregistry](github.com/google/go-containerregistry) to write the manifest without invoking a third build.
0 commit comments