Documentation ¶
Index ¶
- Constants
- Variables
- func CacheMountOpt(pathToCache, cacheIDNamespace string, owner string) llb.RunOption
- func Copy(src llb.State, srcPath string, dest llb.State, destPath string, owner string, ...) llb.State
- func CopyAll(src, dest llb.State, paths map[string]string, owner string, ignoreCache bool) llb.State
- func CopyExternalFiles(state llb.State, externalFiles []ExternalFile) llb.State
- func FromContext(context *builddef.Context, opts ...llb.LocalOption) llb.State
- func ImageSource(imageRef string, withMeta bool) llb.State
- func InstallPackagesWithAPK(state llb.State, packageSpecs []string, opts SystemPackagesCaching) (llb.State, error)
- func InstallPackagesWithAPT(state llb.State, packageSpecs []string, opts SystemPackagesCaching) (llb.State, error)
- func InstallSystemPackages(state llb.State, pkgMgr string, locks map[string]string, ...) (llb.State, error)
- func JSONToDefinition(raw []byte) (*llb.Definition, error)
- func Mkdir(state llb.State, owner string, dirs ...string) llb.State
- func ReadFile(ctx context.Context, ref client.Reference, filepath string) ([]byte, bool, error)
- func SetupAPTCache(state llb.State) llb.State
- func SetupSystemPackagesCache(state llb.State, pkgMgr string) llb.State
- func Shell(cmds ...string) llb.RunOption
- func SolveState(ctx context.Context, c client.Client, src llb.State) (*client.Result, client.Reference, error)
- func StateToJSON(state llb.State) ([]byte, error)
- type ExternalFile
- type SystemPackagesCaching
Constants ¶
const ( // APT is the const used to install apt packages with InstallSystemPackages. APT = "apt" APK = "apk" )
Variables ¶
var ( // UnsupportedPackageManager is thrown when the package manager used by the // base image distro isn't supported by zbuild. UnsupportedPackageManager = xerrors.New("unspported package manager") )
Functions ¶
func CacheMountOpt ¶
CacheMountOpt is used to consistently mount cache folders used when executing commands (eg. to cache downloads of apt, apk or language-specific package managers).
func CopyExternalFiles ¶
func CopyExternalFiles(state llb.State, externalFiles []ExternalFile) llb.State
CopyExternalFiles downloads the given list of ExternalFiles, each in their own DAG tree root (thus they're going to be executed in parallel), decompress and unpack them if required and finally copy them to the given state.
func FromContext ¶
func InstallPackagesWithAPK ¶
func InstallPackagesWithAPT ¶
func InstallSystemPackages ¶
func InstallSystemPackages( state llb.State, pkgMgr string, locks map[string]string, opts SystemPackagesCaching, ) (llb.State, error)
InstallSystemPackages installs the given packages with the given package manager. Packages map have to be a set of package names associated to their respective version.
func JSONToDefinition ¶
func JSONToDefinition(raw []byte) (*llb.Definition, error)
func ReadFile ¶
ReadFile reads the content of the file at given filepath. It returns the file content, a bool indicating if the file was present and an error (excluding ErrNotExists).
func SetupAPTCache ¶
SetupAPTCache adds a Run operation to the given llb.State and returns the new state. That Run operation remove the docker-clean APT config file and replace it with a new config file that explicitly tells APT to keep downloaded files. This function has to be called before running InstallSystemPackages with cache mounts enabled.
Types ¶
type ExternalFile ¶
type ExternalFile struct { URL string Compressed bool Pattern string Destination string Checksum string Mode os.FileMode Owner string }
ExternalFile represents a file that should be loaded through HTTP at build-time.
type SystemPackagesCaching ¶
type SystemPackagesCaching struct { IgnoreLayerCache bool WithCacheMounts bool CacheIDNamespace string }
SystemPackagesCaching holds all the options relating to layer caching and package caching.
func NewCachingStrategyFromBuildOpts ¶
func NewCachingStrategyFromBuildOpts( buildOpts builddef.BuildOpts, ) SystemPackagesCaching