Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Create custom functions without using the provided templates

You can build your own function container images if the templates built into the STACKIT Functions CLI do not provide the languages/technologies you want to use.

Once you have a built container image with the technology of your choice, you can deploy the image using the sfn function deploy command.

Functions container interface

The KNative-based STACKIT Functions runtime expects a linux/amd64 container. Instead of that container, you should:

  • Expose an HTTP 1.1-compatible server on the port defined in the PORT environment variable.
  • Handle the SIGTERM signal to run any cleanup logic.

Build with Dockerfile

You can build containers using technologies other than Buildpacks, as long as the final built container follows the interface explained eariler in Functions container interface.

For example, using a Dockerfile and the STACKIT Container Registry:

docker build . -t <your-registry.domain/group/image> --platform linux/amd64

Then, you can deploy your function using the STACKIT Functions CLI, passing the --build=false and --push=true flags:

sfn function deploy \
    --build=false \
    --push=true \
    --image <your-registry.domain/group/image>

Using existing images

You can deploy existing images to STACKIT Functions if those images match the required functions container interface. For example, images created by the Knative func CLI are compatible with STACKIT Functions, if they have a matching platform of linux/amd64.

To deploy an existing image already uploaded to a Docker/ICO repository with the STACKIT Functions CLI, pass the --push=false and --build=false flags to sfn function deploy:

sfn function deploy \
    --build=false \
    --push=false \
    --image <your-registry.domain/group/image>

This will deploy a function on STACKIT without building or uploading the image anew.