Documentation
¶
Overview ¶
Package tug implements primitives to organize docker buildx operations.
Index ¶
Constants ¶
const TugBuilderName = "tug"
TugBuilderName denotes the name of the buildx builder.
const TugNodeName = "tug0"
TugNodeName denotes the name of the buildx node.
const Version = "0.0.19"
Version is semver.
Variables ¶
var DefaultPlatformsPattern = regexp.MustCompile(`Platforms:\W+(?P<platforms>.+)$`)
DefaultPlatformsPattern denotes the pattern used to extract supported buildx platforms.
var NichePlatforms = []Platform{
{
"linux",
"mips64",
},
}
NichePlatforms may be disabled by default.
var PlatformPattern = regexp.MustCompile(`(?P<os>[^/]+)/(?P<arch>.+)$`)
PlatformPattern denotes the pattern used to extract operating system and architecture variants from buildx platform strings.
var TugBuilderPattern = regexp.MustCompile(`^tug\W+`)
TugBuilderPattern denotes the pattern used to search for the tug builder within the buildx builder list.
Functions ¶
func Clean ¶
Clean empties the active buildx image cache and removes the tug builder,
Returns zero on successful operation. Otherwise, returns non-zero.
func EnsureTugBuilder ¶
EnsureTugBuilder prepares the tug buildx builder.
func RemoveBuildxImageCache ¶
RemoveBuildxImageCache deletes any images/layers in the active buildx cache.
func RemoveTugBuilder ¶
RemoveTugBuilder deletes the tug buildx builder.
Types ¶
type Job ¶
type Job struct {
// Debug can enable additional logging.
Debug bool
// Push can push cached buildx images to the remote Docker registry
// as a side effect during builds.
Push bool
// Builder denotes a buildx builder.
Builder string
// LoadPlatform can load the image for a given platform
// onto the local Docker registry as a side effect during builds.
LoadPlatform *string
// Platforms denotes the list of targeted image platforms.
Platforms []Platform
// OsExclusions skips the given operating systems.
OsExclusions []string
// ArchExclusions skips the given architectures.
ArchExclusions []string
// ListImageName can query the buildx cache
// for any multi-platform images matching the given image name,
// of the form name[:tag].
ListImageName *string
// ImageName denotes the buildx image artifact name,
// of the form name[:tag].
ImageName *string
// BatchSize restricts the number of concurrent builds.
// Zero indicates no restriction.
BatchSize int
// ExtraFlags sends additional command line flags to docker buildx build commands.
ExtraFlags []string
// Directory denotes the Docker build directory (defaults behavior assumes the current working directory).
Directory string
// DockerfileSource denotes the Dockerfile filename, relative to Directory. Default: Dockerfile.
DockerfileSource string
}
Job models a Docker muliti-image build operation.
type Platform ¶
type Platform struct {
// Os denotes a buildx operating system, e.g. "linux".
Os string
// Arch denotes a buildx architecture, e.g. "arm64".
Arch string
}
Platform models a targetable Docker image platform.
func AvailablePlatforms ¶
AvailablePlatforms initializes tug and reports the available buildx platforms.
func DisableNichePlatforms ¶ added in v0.0.2
DisableNichePlatforms filters out some exceedingly niche platforms, which may not have associated base image entries on Docker Hub.
func ParsePlatform ¶
ParsePlatform extracts metadata from a buildx platform string.
type Platforms ¶
type Platforms []Platform
Platforms models a slice of platform(s).
func (Platforms) Len ¶
Len calculates the number of elements in a Platforms collection, in service of sorting.
