builder

package
v0.1.0-alpha.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImage

func BuildImage(ctx context.Context, cli dockerclient.DockerClient, contextPath, dockerfile, tag string, buildArgs map[string]string, noCache bool) (string, error)

BuildImage builds a Docker image from a context directory.

func CacheDir

func CacheDir() (string, error)

CacheDir returns the gridctl cache directory.

func CleanCache

func CleanCache() error

CleanCache removes all cached data.

func CloneOrUpdate

func CloneOrUpdate(url, ref string) (string, error)

CloneOrUpdate clones a git repository or updates it if it already exists. Returns the path to the cloned repository.

func CreateTarFromDir

func CreateTarFromDir(dir string) (io.ReadCloser, error)

CreateTarFromDir creates a tar archive from a directory. This is a simpler alternative if archive.TarWithOptions has issues.

func EnsureCacheDir

func EnsureCacheDir() error

EnsureCacheDir creates the cache directory if it doesn't exist.

func EnsureReposCacheDir

func EnsureReposCacheDir() error

EnsureReposCacheDir creates the repos cache directory if it doesn't exist.

func GenerateTag

func GenerateTag(stack, agentName string) string

GenerateTag creates a deterministic image tag for an agent.

func ReposCacheDir

func ReposCacheDir() (string, error)

ReposCacheDir returns the directory for cached git repositories.

func URLToPath

func URLToPath(url string) (string, error)

URLToPath converts a git URL to a cache path using a hash.

Types

type BuildOptions

type BuildOptions struct {
	// Source configuration
	SourceType string // "git" or "local"
	URL        string // Git URL (for git source)
	Ref        string // Git ref/branch (for git source)
	Path       string // Local path (for local source)

	// Build configuration
	Dockerfile string            // Path to Dockerfile within context
	Tag        string            // Image tag to use
	BuildArgs  map[string]string // Build arguments

	// Cache control
	NoCache bool // Force rebuild, ignore cache
}

BuildOptions contains options for building an image.

type BuildResult

type BuildResult struct {
	ImageID  string // Docker image ID
	ImageTag string // Image tag
	Cached   bool   // Whether the build was cached
}

BuildResult contains the result of a build operation.

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder handles building images from source.

func New

New creates a new Builder instance.

func (*Builder) Build

func (b *Builder) Build(ctx context.Context, opts BuildOptions) (*BuildResult, error)

Build builds an image from the given options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL