func (b *Builder) Build(options *platform.CreateFunctionBuildOptions) (*platform.CreateFunctionBuildResult, error) {
	var err error
	var inferredCodeEntryType string
	var configurationRead bool
	b.options = options
	b.logger.InfoWith("Building",
		"builderKind", b.platform.GetContainerBuilderKind(),
		"versionInfo", b.versionInfo,
		"name", b.options.FunctionConfig.Meta.Name)
	configFilePath := b.providedFunctionConfigFilePath()
	b.logger.DebugWith("Function configuration found in directory", "configFilePath", configFilePath)
	if common.IsFile(configFilePath) {
		if _, err = b.readConfiguration(); err != nil {
			return nil, errors.Wrap(err, "Failed to read configuration")
		}
		configurationRead = true
	}
	if err := b.createTempDir(); err != nil {
		return nil, errors.Wrap(err, "Failed to create base temp dir")
	}
	defer b.cleanupTempDir()  
	if err := b.createStagingDir(); err != nil {
		return nil, errors.Wrap(err, "Failed to create staging dir")
	}
	b.originalFunctionConfig.Spec.Build.Path = b.options.FunctionConfig.Spec.Build.Path
	b.options.FunctionConfig.Spec.Build.Path,
		inferredCodeEntryType,
		err = b.resolveFunctionPath(b.options.FunctionConfig.Spec.Build.Path)
	if err != nil {
		return nil, err
	}
	if b.options.FunctionConfig.Spec.Build.CodeEntryType == "" {
		b.options.FunctionConfig.Spec.Build.CodeEntryType = inferredCodeEntryType
	}
	if common.IsFile(b.options.FunctionConfig.Spec.Build.Path) {
		b.parseInlineBlocks()  
		if b.inlineConfigurationBlock.Error != nil {
			return nil, errors.Wrap(b.inlineConfigurationBlock.Error, "Failed to parse inline configuration")
		}
		b.populateFunctionSourceCodeFromFilePath()
	}
	if !configurationRead {
		if _, err := b.readConfiguration(); err != nil {
			return nil, errors.Wrap(err, "Failed to read configuration")
		}
	}
	b.runtime, err = b.createRuntime()
	if err != nil {
		return nil, errors.Wrap(err, "Failed create runtime")
	}
	if err := b.validateAndEnrichConfiguration(); err != nil {
		return nil, errors.Wrap(err, "Failed to enrich configuration")
	}
	enrichedConfiguration := b.options.FunctionConfig
	if enrichedConfiguration.Spec.Build.CodeEntryType == ImageEntryType {
		enrichedConfiguration.Spec.Build.Path = ""
	} else {
		enrichedConfiguration.Spec.Build.Path = b.originalFunctionConfig.Spec.Build.Path
	}
	if b.options.OnAfterConfigUpdate != nil {
		if err := b.options.OnAfterConfigUpdate(&enrichedConfiguration); err != nil {
			return nil, errors.Wrap(err, "OnAfterConfigUpdate returned error")
		}
	}
	if err := b.prepareStagingDir(); err != nil {
		return nil, errors.Wrap(err, "Failed to prepare staging dir")
	}
	processorImage, err := b.buildProcessorImage()
	if err != nil {
		return nil, errors.Wrap(err, "Failed to build processor image")
	}
	if enrichedConfiguration.Spec.Build.CodeEntryType == ImageEntryType {
		enrichedConfiguration.Spec.Image = processorImage
	}
	buildResult := &platform.CreateFunctionBuildResult{
		Image:                 processorImage,
		UpdatedFunctionConfig: enrichedConfiguration,
	}
	b.logger.InfoWith("Build complete", "result", buildResult)
	return buildResult, nil
}
Build builds the handler
package build
import (
	"bytes"
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"math"
	"net/http"
	"net/url"
	"os"
	"path"
	"path/filepath"
	"strings"
	"text/template"
	"time"
	"github.com/nuclio/nuclio/pkg/common"
	gitcommon "github.com/nuclio/nuclio/pkg/common/git"
	"github.com/nuclio/nuclio/pkg/containerimagebuilderpusher"
	"github.com/nuclio/nuclio/pkg/functionconfig"
	"github.com/nuclio/nuclio/pkg/platform"
	"github.com/nuclio/nuclio/pkg/processor/build/inlineparser"
	"github.com/nuclio/nuclio/pkg/processor/build/runtime"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/dotnetcore"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/golang"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/java"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/nodejs"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/python"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/ruby"
	_ "github.com/nuclio/nuclio/pkg/processor/build/runtime/shell"
	"github.com/nuclio/nuclio/pkg/processor/build/util"
	"github.com/mholt/archiver/v3"
	"github.com/mitchellh/mapstructure"
	"github.com/nuclio/errors"
	"github.com/nuclio/logger"
	"github.com/nuclio/nuclio-sdk-go"
	"github.com/v3io/version-go"
	"gopkg.in/yaml.v2"
)
const (
	FunctionConfigFileName = "function.yaml"
	uhttpcImage            = "quay.io/nuclio/uhttpc:0.0.1-%s"
	GitEntryType           = "git"
	GithubEntryType        = "github"
	ArchiveEntryType       = "archive"
	S3EntryType            = "s3"
	ImageEntryType         = "image"
	SourceCodeEntryType    = "sourceCode"
)
type runtimeInfo struct {
	extension    string
	inlineParser inlineparser.ConfigParser
	weight int
}
type Builder struct {
	logger logger.Logger
	platform platform.Platform
	options *platform.CreateFunctionBuildOptions
	runtime runtime.Runtime
	tempDir string
	stagingDir string
	inlineConfigurationBlock inlineparser.Block
	processorImage struct {
		objectsToCopyDuringBuild map[string]string
		imageName string
		imageTag string
	}
	runtimeInfo map[string]runtimeInfo
	originalFunctionConfig functionconfig.Config
	s3Client common.S3Client
	versionInfo *version.Info
	gitClient gitcommon.Client
}
func NewBuilder(parentLogger logger.Logger, platform platform.Platform, s3Client common.S3Client) (*Builder, error) {
	var err error
	newBuilder := &Builder{
		logger:      parentLogger,
		platform:    platform,
		s3Client:    s3Client,
		versionInfo: version.Get(),
	}
	newBuilder.initializeSupportedRuntimes()
	newBuilder.gitClient, err = gitcommon.NewClient(newBuilder.logger)
	if err != nil {
		return nil, errors.Wrap(err, "Failed to create git client")
	}
	return newBuilder, nil
}