Documentation
¶
Index ¶
- func BuildImage(ctx context.Context, cli dockerclient.DockerClient, ...) (string, error)
- func CacheDir() (string, error)
- func CleanCache() error
- func CloneOrUpdate(url, ref string) (string, error)
- func CreateTarFromDir(dir string) (io.ReadCloser, error)
- func EnsureCacheDir() error
- func EnsureReposCacheDir() error
- func GenerateTag(stack, agentName string) string
- func ReposCacheDir() (string, error)
- func URLToPath(url string) (string, error)
- type BuildOptions
- type BuildResult
- type Builder
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 CloneOrUpdate ¶
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 ¶
GenerateTag creates a deterministic image tag for an agent.
func ReposCacheDir ¶
ReposCacheDir returns the directory for cached git repositories.
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 (*Builder) Build ¶
func (b *Builder) Build(ctx context.Context, opts BuildOptions) (*BuildResult, error)
Build builds an image from the given options.