Documentation ¶
Index ¶
- func Parse(ast *parser.Node, lint *linter.Linter) (stages []Stage, metaArgs []ArgCommand, err error)
- func ParseInstructionWithLinter(node *parser.Node, lint *linter.Linter) (v interface{}, err error)
- type AddCommand
- type ArgCommand
- type BFlags
- type CatCommand
- type CmdCommand
- type CmdParameter
- type Command
- type ConvertCommand
- type CopyCommand
- type Flag
- type FromGetter
- type KeyValuePair
- type KeyValuePairOptional
- type KeyValuePairs
- type LabelCommand
- type PlatformSpecific
- type QuantizeCommand
- type SingleWordExpander
- type SourceContent
- type SourcesAndDest
- type Stage
- type SupportsSingleWordExpansion
- type SupportsSingleWordExpansionRaw
- type UnknownInstructionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddCommand ¶
type AddCommand struct { SourcesAndDest Chown string Chmod string Link bool ExcludePatterns []string KeepGitDir bool // whether to keep .git dir, only meaningful for git sources Checksum string // contains filtered or unexported fields }
AddCommand adds files from the provided sources to the target destination.
ADD foo /path
ADD supports tarball and remote URL handling, which may not always be desired - if you do not wish to have this automatic handling, use COPY.
func (*AddCommand) Expand ¶
func (c *AddCommand) Expand(expander SingleWordExpander) error
type ArgCommand ¶
type ArgCommand struct { Args []KeyValuePairOptional // contains filtered or unexported fields }
ArgCommand adds the specified variable to the list of variables that can be passed to the builder using the --build-arg flag for expansion and substitution.
ARG name[=value]
func (*ArgCommand) Expand ¶
func (c *ArgCommand) Expand(expander SingleWordExpander) error
type BFlags ¶
type BFlags = instructions.BFlags
BFlags contains all flags information for the builder
func NewBFlagsWithArgs ¶
NewBFlagsWithArgs returns the new BFlags struct with Args set to args
type CatCommand ¶
type CatCommand struct { SourcesAndDest // contains filtered or unexported fields }
CatCommand concatenate content to a file.
CAT "hi" /path
type CmdCommand ¶
type CmdCommand struct { Args []string Model *CmdParameter Drafter *CmdParameter Projector *CmdParameter Adapters []CmdParameter // contains filtered or unexported fields }
CmdCommand sets the default command to run in the container on start.
CMD ["-m", "model.gguf"] # echo hi
func (*CmdCommand) Expand ¶
func (c *CmdCommand) Expand(expander SingleWordExpander) error
type CmdParameter ¶
CmdParameter represents a parameter to a CMD.
type Command ¶
type Command = instructions.Command
Command interface is implemented by every possible command in a GGUFPackerfile.
The interface only exposes the minimal common elements shared between every command, while more detailed information per-command can be extracted using runtime type analysis, e.g. type-switches.
type ConvertCommand ¶
type ConvertCommand struct { SourcesAndDest From string Class string Type string BaseModel string // contains filtered or unexported fields }
ConvertCommand converts a model to target type GGUF file.
CONVERT foo /path
func (*ConvertCommand) Expand ¶
func (c *ConvertCommand) Expand(expander SingleWordExpander) error
func (*ConvertCommand) GetFrom ¶
func (c *ConvertCommand) GetFrom() string
type CopyCommand ¶
type CopyCommand struct { SourcesAndDest From string Chown string Chmod string Link bool ExcludePatterns []string Parents bool // parents preserves directory structure // contains filtered or unexported fields }
CopyCommand copies files from the provided sources to the target destination.
COPY foo /path
Same as 'ADD' but without the magic additional tarball and remote URL handling.
func (*CopyCommand) Expand ¶
func (c *CopyCommand) Expand(expander SingleWordExpander) error
func (*CopyCommand) GetFrom ¶
func (c *CopyCommand) GetFrom() string
type FromGetter ¶
type FromGetter interface {
GetFrom() string
}
FromGetter is an interface for commands that be able to parameterize with --from flag.
type KeyValuePair ¶
type KeyValuePair = instructions.KeyValuePair
KeyValuePair represents an arbitrary named value.
This is useful for commands containing key-value maps that want to preserve the order of insertion, instead of map[string]string which does not.
type KeyValuePairOptional ¶
type KeyValuePairOptional = instructions.KeyValuePairOptional
KeyValuePairOptional is identical to KeyValuePair, but allows for optional values.
type KeyValuePairs ¶
type KeyValuePairs = instructions.KeyValuePairs
KeyValuePairs is a slice of KeyValuePair
type LabelCommand ¶
type LabelCommand struct { Labels KeyValuePairs // contains filtered or unexported fields }
LabelCommand sets an image label in the output
LABEL some json data describing the image
func (*LabelCommand) Expand ¶
func (c *LabelCommand) Expand(expander SingleWordExpander) error
type PlatformSpecific ¶
type PlatformSpecific = instructions.PlatformSpecific
PlatformSpecific adds platform checks to a command
type QuantizeCommand ¶
type QuantizeCommand struct { SourcesAndDest From string Type string Imatrix string IncludeWeights []string ExcludeWeights []string LeaveOutputTensor bool Pure bool OutputTensorType string TokenEmbeddingType string // contains filtered or unexported fields }
QuantizeCommand converts a GGUF file to target type GGUF file.
Quantize foo /path
func (*QuantizeCommand) Expand ¶
func (c *QuantizeCommand) Expand(expander SingleWordExpander) error
func (*QuantizeCommand) GetFrom ¶
func (c *QuantizeCommand) GetFrom() string
type SingleWordExpander ¶
type SingleWordExpander = instructions.SingleWordExpander
SingleWordExpander is a provider for variable expansion where a single word corresponds to a single output.
type SourceContent ¶
type SourceContent struct { Path string // path to the file Data string // string content from the file Expand bool // whether to expand file contents }
SourceContent represents an anonymous file object
type SourcesAndDest ¶
type SourcesAndDest struct { DestPath string // destination to write output SourcePaths []string // file path sources SourceContents []SourceContent // anonymous file sources }
SourcesAndDest represent a collection of sources and a destination
func (*SourcesAndDest) Expand ¶
func (s *SourcesAndDest) Expand(expander SingleWordExpander) error
func (*SourcesAndDest) ExpandRaw ¶
func (s *SourcesAndDest) ExpandRaw(expander SingleWordExpander) error
type Stage ¶
type Stage struct { Name string // name of the stage Commands []Command // commands contained within the stage BaseName string // name of the base stage or source BaseDigest string // digest of the base stage or source Platform string // platform of base source to use Comment string // doc-comment directly above the stage SourceCode string // contents of the defining FROM command Location []parser.Range // location of the defining FROM command CmdCommand *CmdCommand // CmdCommand of the stage }
Stage represents a bundled collection of commands.
Each stage begins with a FROM command (which is consumed into the Stage), indicating the source or stage to derive from, and ends either at the end-of-the file, or the start of the next stage.
Stages can be named, and can be additionally configured to use a specific platform, in the case of a multi-arch base image.
func CurrentStage ¶
CurrentStage returns the last stage from a list of stages.
func (*Stage) AddCommand ¶
AddCommand appends a command to the stage.
type SupportsSingleWordExpansion ¶
type SupportsSingleWordExpansion = instructions.SupportsSingleWordExpansion
SupportsSingleWordExpansion interface allows a command to support variable.
type SupportsSingleWordExpansionRaw ¶
type SupportsSingleWordExpansionRaw = instructions.SupportsSingleWordExpansionRaw
SupportsSingleWordExpansionRaw interface allows a command to support variable expansion, while ensuring that minimal transformations are applied during expansion, so that quotes and other special characters are preserved.
type UnknownInstructionError ¶
UnknownInstructionError represents an error occurring when a command is unresolvable
func (*UnknownInstructionError) Error ¶
func (e *UnknownInstructionError) Error() string