Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnalyzeIssues ¶
func AnalyzeIssues(df *ParsedDockerfile) []string
AnalyzeIssues returns a list of human-readable improvement suggestions.
func FormatBytes ¶
FormatBytes is the exported variant of humanBytes for use in cmd packages.
Types ¶
type ComparisonResult ¶
type ComparisonResult struct {
Before *ImageStats
After *ImageStats
SavedBytes int64
ReductionPct float64
}
CompareImages measures two images and returns the reduction statistics.
func CompareImages ¶
func CompareImages(ctx context.Context, beforeRef, afterRef string) (*ComparisonResult, error)
CompareImages inspects both images and computes the size delta.
type ImageStats ¶
type ImageStats struct {
Ref string
ID string
SizeBytes int64
Layers int
Architecture string
OS string
}
ImageStats holds size information retrieved from the Docker daemon.
func InspectImage ¶
func InspectImage(ctx context.Context, imageRef string) (*ImageStats, error)
InspectImage connects to the local Docker daemon and returns size metadata for the given image reference (e.g. "myapp:latest" or a digest).
func (*ImageStats) HumanSize ¶
func (s *ImageStats) HumanSize() string
HumanSize returns a human-readable size string (KB / MB / GB).
type Instruction ¶
Instruction represents a Dockerfile instruction
type Optimizer ¶
type Optimizer struct {
// contains filtered or unexported fields
}
Optimizer analyzes and optimizes Dockerfile instructions
func NewOptimizer ¶
func (*Optimizer) CleanCommands ¶
CleanCommands returns optimized shell commands (removing caches, temporary files)
type ParsedDockerfile ¶
type ParsedDockerfile struct {
BaseImage string
IsMultiStage bool
HasDistroless bool
HasNobodyUser bool
PackageManager string
Stages []Stage
}
ParsedDockerfile holds structured information extracted from an existing Dockerfile.
func ParseFile ¶
func ParseFile(path string) (*ParsedDockerfile, error)
ParseFile reads a Dockerfile from disk and returns structured metadata.
func ParseString ¶
func ParseString(content string) *ParsedDockerfile
ParseString parses Dockerfile content from a string (useful in tests).