Documentation ¶
Overview ¶
Package zeaburpack is the library of zbpack.
Index ¶
- Variables
- func Build(opt *BuildOptions) error
- func NewHandledWriter(w console.File, handler *func(log string)) console.File
- func Plan(opt PlanOptions) (types.PlanType, types.PlanMeta)
- func PlanAndOutputDockerfile(opt PlanOptions) error
- func PrintPlanAndMeta(plan types.PlanType, meta types.PlanMeta, printFunc func(log string))
- func SupportedIdentifiers() []plan.Identifier
- func SupportedPackers() []packer.Packer
- func UpdateOptionsOnConfig[T ZbpackOptions](options T, config plan.ImmutableProjectConfiguration)
- type BuildOptions
- type FromStatement
- type HandledWriter
- type PlanOptions
- type ZbpackOptions
Constants ¶
This section is empty.
Variables ¶
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 NewHandledWriter ¶
NewHandledWriter creates a new HandledWriter.
func Plan ¶
func Plan(opt PlanOptions) (types.PlanType, types.PlanMeta)
Plan returns the build plan and metadata.
func PlanAndOutputDockerfile ¶
func PlanAndOutputDockerfile(opt PlanOptions) error
PlanAndOutputDockerfile output dockerfile.
func PrintPlanAndMeta ¶
PrintPlanAndMeta prints the build plan and meta in a table format.
func SupportedIdentifiers ¶
func SupportedIdentifiers() []plan.Identifier
SupportedIdentifiers returns all supported identifiers note that they are in the order of priority
func SupportedPackers ¶
SupportedPackers returns all supported identifiers
func UpdateOptionsOnConfig ¶
func UpdateOptionsOnConfig[T ZbpackOptions](options T, config plan.ImmutableProjectConfiguration)
UpdateOptionsOnConfig updates the undefined options (nil) with the value from project configuration.
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) // HandleBuildFailed is a callback function that will be called when // the build failed. HandleBuildFailed *func(error) // HandleLog is a function that will be called when a log is emitted. HandleLog *func(string) // 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 // CustomBuildCommand is a custom build command that will be used instead of the default one. CustomBuildCommand *string // CustomStartCommand is a custom start command that will be used instead of the default one. CustomStartCommand *string // OutputDir is the directory where the build artifacts will be stored. // Once provided, the service will deploy as static files with nginx. OutputDir *string 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.
type FromStatement ¶
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 HandledWriter ¶
HandledWriter is a console-compatible writer that copies the output to the specified log and calls handler with the log.
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 // CustomBuildCommand is a custom build command that will be used instead of the default one. CustomBuildCommand *string // CustomStartCommand is a custom start command that will be used instead of the default one. CustomStartCommand *string // OutputDir is the directory where the build artifacts will be stored. // Once provided, the service will deploy as static files with nginx. OutputDir *string }
PlanOptions is the options for Plan function.
type ZbpackOptions ¶
type ZbpackOptions interface { *PlanOptions | *BuildOptions }
ZbpackOptions is the union type of the pointer to PlanOptions and BuildOptions.