Documentation ¶
Overview ¶
Package zeaburpack is the library of zbpack.
Index ¶
- Variables
- func Build(opt *BuildOptions) error
- func InjectDockerfile(dockerfile string, registry *string, variables map[string]string) string
- func Plan(opt PlanOptions) (types.PlanType, types.PlanMeta)
- func PlanAndOutputDockerfile(opt PlanOptions) error
- func PrintPlanAndMeta(plan types.PlanType, meta types.PlanMeta, writer io.Writer)
- func SupportedIdentifiers(config plan.ImmutableProjectConfiguration) []plan.Identifier
- func SupportedPackers() []packer.Packer
- type BuildOptions
- type FromStatement
- type PlanOptions
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 InjectDockerfile ¶
InjectDockerfile injects the environment variables and the Docker.io registry into the Dockerfile.
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(config plan.ImmutableProjectConfiguration) []plan.Identifier
SupportedIdentifiers returns all supported identifiers note that they are in the order of priority
func SupportedPackers ¶
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 ¶
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.