discovery

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package discovery provides Dockerfile discovery with glob pattern support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsGlobChars added in v0.13.0

func ContainsGlobChars(path string) bool

ContainsGlobChars reports whether the path contains glob special characters.

func DefaultPatterns

func DefaultPatterns() []string

DefaultPatterns returns the default Dockerfile patterns. These cover common naming conventions: - Dockerfile (standard) - Dockerfile.* (Dockerfile.dev, Dockerfile.prod, etc.) - *.Dockerfile (api.Dockerfile, frontend.Dockerfile, etc.) - Containerfile (Podman convention)

Types

type DiscoveredFile

type DiscoveredFile struct {
	// Path is the path to the Dockerfile.
	// For explicit file inputs, this preserves the original path (relative or absolute).
	// For discovered files (from directories/globs), this is an absolute path.
	Path string

	// ConfigRoot is the directory to use for config file discovery.
	// This is typically the directory containing the Dockerfile.
	ConfigRoot string

	// ContextDir is the build context directory (optional).
	// When set, enables context-aware rules like copy-ignored-file.
	ContextDir string
}

DiscoveredFile represents a Dockerfile discovered during file discovery.

func Discover

func Discover(inputs []string, opts Options) ([]DiscoveredFile, error)

Discover finds Dockerfiles matching the given inputs. Each input can be: - A specific file path - A directory (searched recursively with default patterns) - A glob pattern (expanded with doublestar)

Results are deduplicated by absolute path and sorted.

type FileNotFoundError added in v0.13.0

type FileNotFoundError struct {
	Path string
}

FileNotFoundError is returned when an explicit (non-glob) path does not exist.

func (*FileNotFoundError) Error added in v0.13.0

func (e *FileNotFoundError) Error() string

type Options

type Options struct {
	// Patterns are the glob patterns to match (default: DefaultPatterns()).
	// Supports doublestar patterns like "**/*.Dockerfile".
	Patterns []string

	// ExcludePatterns are glob patterns to exclude from results.
	ExcludePatterns []string

	// ContextDir is the build context directory to use for all discovered files.
	// If empty, no context is set.
	ContextDir string
}

Options configures file discovery behavior.

Jump to

Keyboard shortcuts

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