Deploying Pre-Built Functions#

This guide goes through building functions to container images and then deploying them in a separate process.

In this document#


If you followed the function-deployment guide, you built and deployed a function in a single convenient step using the nuctl CLI. However, it is sometimes desirable to build a function once and deploy it many times with different configuration. This guide will walk you through that process using nuctl.

In this scenario, you’ll use the Go hello-world example.


apiVersion: ""
kind: "NuclioFunction"
  description: Showcases unstructured logging and a structured response.
  runtime: "golang"
  minReplicas: 1
  maxReplicas: 1
  handler: main:Handler


package main

import (

func Handler(context *nuclio.Context, event nuclio.Event) (interface{}, error) {
	context.Logger.Info("This is an unstructured %s", "log")

	return nuclio.Response{
		StatusCode:  200,
		ContentType: "application/text",
		Body:        []byte("Hello, from Nuclio :]"),
	}, nil

Building a function#

Using nuctl, you can issue a build - specifying the URL of the Go hello-world:

nuctl build hello-world --path \
    --registry $(minikube ip):5000

This produces the nuclio/processor-hello-world:latest image and pushes it to The image contains everything the function needs to run, except a configuration file.

Deploying the pre-built function#

To deploy the function to your platform, you’ll use the nuctl deploy command with the --run-image option. When --run-image is present, nuctl does not initiate a build process - only creates a function in the platform and waits for it to become ready.

nuctl deploy hello-world --run-image localhost:5000/nuclio/processor-hello-world:latest \
    --runtime golang \
    --handler main:Handler \
    --namespace nuclio

You can deploy this function several times, providing different labels, triggers, etc. - yet still use the same image.

See also#