Documentation
¶
Overview ¶
Package bake parses mybuild declarative config files.
Supported formats:
- HCL: kforge.hcl (preferred)
- JSON: kforge.json
Example kforge.hcl:
variable "TAG" { default = "latest" }
target "app" {
context = "."
dockerfile = "Dockerfile"
platforms = ["linux/amd64", "linux/arm64"]
tags = ["myrepo/app:${TAG}"]
cache-from = ["type=registry,ref=myrepo/app:cache"]
cache-to = ["type=registry,ref=myrepo/app:cache,mode=max"]
push = true
}
group "default" {
targets = ["app"]
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFiles = []string{
"kforge.hcl",
"kforge.json",
}
DefaultFiles is the lookup order for config files.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Variables []Variable `hcl:"variable,block"`
Targets []Target `hcl:"target,block"`
Groups []Group `hcl:"group,block"`
}
File represents the full parsed config.
func Load ¶
Load finds and parses the first config file that exists. Returns an error if no config file is found.
type Group ¶
type Group struct {
Name string `hcl:"name,label" json:"name,omitempty"`
Targets []string `hcl:"targets" json:"targets"`
}
Group is a named collection of targets.
type Target ¶
type Target struct {
Name string `hcl:"name,label" json:"name,omitempty"`
Context string `hcl:"context,optional" json:"context,omitempty"`
Dockerfile string `hcl:"dockerfile,optional" json:"dockerfile,omitempty"`
Platforms []string `hcl:"platforms,optional" json:"platforms,omitempty"`
Tags []string `hcl:"tags,optional" json:"tags,omitempty"`
CacheFrom []string `hcl:"cache-from,optional" json:"cache-from,omitempty"`
CacheTo []string `hcl:"cache-to,optional" json:"cache-to,omitempty"`
BuildArgs []string `hcl:"build-args,optional" json:"build-args,omitempty"`
Target string `hcl:"target,optional" json:"target,omitempty"`
Push bool `hcl:"push,optional" json:"push,omitempty"`
Load bool `hcl:"load,optional" json:"load,omitempty"`
NoCache bool `hcl:"no-cache,optional" json:"no-cache,omitempty"`
Secrets []string `hcl:"secrets,optional" json:"secrets,omitempty"`
}
Target represents a single build target.
Click to show internal directories.
Click to hide internal directories.