dotnetexecute

package module
v0.14.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

README

.NET Execute Cloud Native Buildpack

The .NET Execute CNB sets the start command for a given .Net Core application once it has been built by preceding buildpacks.

Integration

The .NET Execute CNB completes the setup of a .Net Core application built using a sequence of CNBs. As such, it will be the only non-optional CNB in that sequence and is not explicitly required by any CNB that precedes it.

It provides dotnet-execute as a dependency, but currently there's no scenario we can imagine that you would use a downstream buildpack to require this dependency. If a user likes to include some other functionality, it can be done independent of the .NET Execute CNB without requiring a dependency of it.

To package this buildpack for consumption:

$ ./scripts/package.sh

This builds the buildpack's source using GOOS=linux by default. You can supply another value as the first argument to package.sh.

Specifying a project path

To specify a project subdirectory (i.e. the directory containing your .csproj/.fsproj/.vbproj file), please use the BP_DOTNET_PROJECT_PATH environment variable at build time either directly (e.g. pack build my-app --env BP_DOTNET_PROJECT_PATH=./src/my-app) or through a project.toml file. This configuration does not apply to FDD, FDE or Self-Contained app deployments.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(
	config Configuration,
	buildpackYMLParser BuildpackConfigParser,
	configParser ConfigParser,
	sbomGenerator SBOMGenerator,
	logger scribe.Emitter,
	clock chronos.Clock,
) packit.BuildFunc

Build will return a packit.BuildFunc that will be invoked during the build phase of the buildpack lifecycle.

Build generates a SBOM of the .NET app's dependencies based on its compiled DLLs. It sets up the entrypoint for the app image and adds a helper that will determine at launch-time which container port the app should listen on.

func Detect

func Detect(
	config Configuration,
	logger scribe.Emitter,
	buildpackYMLParser BuildpackConfigParser,
	configParser ConfigParser,
	projectParser ProjectParser,
) packit.DetectFunc

Detect will return a packit.DetectFunc that will be invoked during the detect phase of the buildpack lifecycle.

Detection will contribute a Build Plan that requires different things depending on the type of app being built. See Configuration for details on how environment variable configuration influences detection.

Source Code Apps

The buildpack will require .NET Core ASP.NET Runtime at launch-time. It will require ICU at launch time. It will require Nodejs at launch time if the app relies on JavaScript components.

Framework-dependent Deployments

The buildpack will require the .NET Core ASP.NET Runtime at launch-time to run the framework-dependent app. It will require ICU at launch time. It will require Nodejs if the app relies on JavaScript components.

Framework-dependent Executables

The buildpack will require the .NET Core ASP.NET Runtime at launch-time to run the framework-dependent app. It will require ICU at launch time. It will require Nodejs at launch time if the app relies on JavaScript components.

Self-contained Executables The buildpack will require ICU at launch time. It will require Nodejs at launch time if the app relies on JavaScript components.

Types

type BuildPlanMetadata added in v0.11.1

type BuildPlanMetadata struct {
	Version       string `toml:"version,omitempty"`
	VersionSource string `toml:"version-source,omitempty"`
	Launch        bool   `toml:"launch"`
}

type BuildpackConfigParser added in v0.1.0

type BuildpackConfigParser interface {
	ParseProjectPath(path string) (projectPath string, err error)
}

type BuildpackYMLParser

type BuildpackYMLParser struct{}

func NewBuildpackYMLParser

func NewBuildpackYMLParser() BuildpackYMLParser

func (BuildpackYMLParser) Parse

func (p BuildpackYMLParser) Parse(path string) (Config, error)

func (BuildpackYMLParser) ParseProjectPath

func (p BuildpackYMLParser) ParseProjectPath(path string) (string, error)

type Config

type Config struct {
	ProjectPath string `yaml:"project-path"`
}

type ConfigParser added in v0.1.0

type ConfigParser interface {
	Parse(glob string) (RuntimeConfig, error)
}

type Configuration added in v0.11.0

type Configuration struct {

	// When BP_DEBUG_ENABLED=TRUE, the buildpack will include the Visual Studio
	// Debugger in the app launch image Remote debuggers can invoke vsdbg inside
	// the running app container and attach to vsdbg's exposed port; also, the
	// buildpack will set ASPNETCORE_ENVIRONMENT=Development.
	DebugEnabled bool `env:"BP_DEBUG_ENABLED"`

	// When BP_LIVE_RELOAD_ENABLED=TRUE, the buildpack will make the app's entrypoint
	// process reload on changes to program files in the app container. It will
	// include watchexec in the app launch image and make the default container
	// entrypoint watchexec + <the usual app entrypoint>. See
	// https://github.com/watchexec/watchexec for more on watchexec as a
	// reloadable process manager.
	LiveReloadEnabled bool `env:"BP_LIVE_RELOAD_ENABLED"`

	// BP_LOG_LEVEL determines the amount of logs produced by the buildpack. Set
	// BP_LOG_LEVEL=DEBUG for more detailed logs.
	LogLevel string `env:"BP_LOG_LEVEL,default=INFO"`

	// When BP_DOTNET_PROJECT_PATH is set to a relative path, the buildpack
	// will look for project file(s) in that subdirectory to determine which
	// project to build into the app container.
	ProjectPath string `env:"BP_DOTNET_PROJECT_PATH"`
}

Configuration enumerates the environment variable configuration options that govern the buildpack's behaviour.

type ProjectFileParser added in v0.1.0

type ProjectFileParser struct{}

func NewProjectFileParser added in v0.1.0

func NewProjectFileParser() ProjectFileParser

func (ProjectFileParser) FindProjectFile added in v0.3.0

func (p ProjectFileParser) FindProjectFile(path string) (string, error)

func (ProjectFileParser) NPMIsRequired added in v0.1.0

func (p ProjectFileParser) NPMIsRequired(path string) (bool, error)

func (ProjectFileParser) NodeIsRequired added in v0.1.0

func (p ProjectFileParser) NodeIsRequired(path string) (bool, error)

type ProjectParser added in v0.1.0

type ProjectParser interface {
	FindProjectFile(root string) (string, error)
	NodeIsRequired(path string) (bool, error)
}

type RuntimeConfig added in v0.1.0

type RuntimeConfig struct {
	Path           string
	RuntimeVersion string
	ASPNETVersion  string
	AppName        string
	Executable     bool
}

type RuntimeConfigParser added in v0.1.0

type RuntimeConfigParser struct{}

func NewRuntimeConfigParser added in v0.1.0

func NewRuntimeConfigParser() RuntimeConfigParser

func (RuntimeConfigParser) Parse added in v0.1.0

func (p RuntimeConfigParser) Parse(glob string) (RuntimeConfig, error)

type SBOMGenerator added in v0.9.0

type SBOMGenerator interface {
	Generate(path string) (sbom.SBOM, error)
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL