zeaburpack

package
v0.0.0-...-3792e47 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MPL-2.0 Imports: 45 Imported by: 0

Documentation

Overview

Package zeaburpack is the library of zbpack.

Index

Constants

This section is empty.

Variables

View Source
var ServerlessTarPath = filepath.Join(
	lo.Must(os.MkdirTemp("", "zbpack-buildkit-artifact-*")),
	"serverless-output.tar",
)

ServerlessTarPath is the path to the serverless output tar file

Functions

func Build

func Build(opt *BuildOptions) error

Build will analyze the project, determine the plan and build the image.

func InjectDockerfile

func InjectDockerfile(dockerfile string, registry *string, variables map[string]string) string

InjectDockerfile injects the environment variables and the Docker.io registry into the Dockerfile.

func Plan

Plan returns the build plan and metadata.

func PlanAndOutputDockerfile

func PlanAndOutputDockerfile(opt PlanOptions) error

PlanAndOutputDockerfile output dockerfile.

func PrintPlanAndMeta

func PrintPlanAndMeta(plan types.PlanType, meta types.PlanMeta, writer io.Writer)

PrintPlanAndMeta prints the build plan and meta in a table format.

func SupportedIdentifiers

func SupportedIdentifiers(config plan.ImmutableProjectConfiguration) []plan.Identifier

SupportedIdentifiers returns all supported identifiers note that they are in the order of priority

func SupportedPackers

func SupportedPackers() []packer.Packer

SupportedPackers returns all supported identifiers

Types

type BuildOptions

type BuildOptions struct {
	// SubmoduleName is the of the submodule to build.
	// For example, if directory is considered as a Go project,
	// submoduleName would be used to try file in `cmd` directory.
	// in Zeabur internal system, this is the name of the service.
	SubmoduleName *string

	// HandlePlanDetermined is a callback function that will be called when
	// the build plan is determined.
	HandlePlanDetermined *func(types.PlanType, types.PlanMeta)

	// LogWriter is a [io.Writer] that will be written when a log is emitted.
	// nil to use the default log writer.
	LogWriter io.Writer

	// Path is the path to the project directory.
	Path *string

	// ResultImage is the name of the image that will be built.
	ResultImage *string

	// UserVars is a map of user variables that will be used in the Dockerfile.
	UserVars *map[string]string

	// Interactive is a flag to indicate if the build should be interactive.
	Interactive *bool

	CacheFrom *string
	CacheTo   *string

	// ProxyRegistry is the registry to be used for the image.
	// See referenceConstructor for more details.
	ProxyRegistry *string

	// PushImage is a flag to indicate if the image should be pushed to the registry.
	PushImage bool
}

BuildOptions is the options for the Build function.

func (*BuildOptions) Log

func (opt *BuildOptions) Log(msg string, args ...any)

Log writes a log message to the log writer.

It passes the parameters to fmt.Fprintf internally.

type FromStatement

type FromStatement struct {
	Source string
	Stage  mo.Option[string]
}

FromStatement represents a FROM statement in a Dockerfile.

func ParseFrom

func ParseFrom(line string) (FromStatement, bool)

ParseFrom parses a FROM statement from a Dockerfile line.

func (FromStatement) String

func (fs FromStatement) String() string

type PlanOptions

type PlanOptions struct {
	// SubmoduleName is the of the submodule to build.
	// For example, if a directory is considered as a Go project,
	// submoduleName would be used to try file in `cmd` directory.
	// in Zeabur internal system, this is the name of the service.
	SubmoduleName *string

	// Path is the path to the project directory.
	Path *string

	// Access token for GitHub, only used when Path is a GitHub URL.
	AccessToken *string

	// AWSConfig is the AWS configuration to access S3, required if Path is an S3 URL.
	AWSConfig *plan.AWSConfig
}

PlanOptions is the options for Plan function.

Jump to

Keyboard shortcuts

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