discovery

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: Apache-2.0 Imports: 6 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 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 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