dockerfile2dot

package
v0.17.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package dockerfile2dot provides the functionality for loading a Dockerfile and converting it into a GraphViz DOT file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDotFile

func BuildDotFile(
	simplifiedDockerfile SimplifiedDockerfile,
	concentrate bool,
	edgestyle string,
	layers bool,
	legend bool,
	maxLabelLength int,
	nodesep string,
	ranksep string,
) string

BuildDotFile builds a GraphViz .dot file from a simplified Dockerfile

Types

type ExternalImage added in v0.8.0

type ExternalImage struct {
	Name string
}

ExternalImage holds the name of an external image.

type Layer added in v0.8.0

type Layer struct {
	Label    string    // the command and truncated args
	WaitFors []WaitFor // stages or external images for which this layer needs to wait
}

Layer stores the changes compared to the image it’s based on within a multi-stage Dockerfile.

type SimplifiedDockerfile

type SimplifiedDockerfile struct {
	// Args set before the first stage, see
	// https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
	BeforeFirstStage []Layer
	// Build stages
	Stages []Stage
	// External images
	ExternalImages []ExternalImage
}

SimplifiedDockerfile contains the parts of the Dockerfile that are relevant for generating the multi-stage build graph.

func LoadAndParseDockerfile

func LoadAndParseDockerfile(
	inputFS afero.Fs,
	filename string,
	maxLabelLength int,
) (SimplifiedDockerfile, error)

LoadAndParseDockerfile looks for the Dockerfile and returns a SimplifiedDockerfile.

type Stage

type Stage struct {
	Name   string  // the part after the AS in the FROM line
	Layers []Layer // the layers of the stage
}

Stage represents a single build stage within the multi-stage Dockerfile or an external image.

type WaitFor added in v0.3.0

type WaitFor struct {
	Name string      // the name of the stage or external image for which the builder has to wait
	Type waitForType // the reason why it has to wait
}

WaitFor holds the name of the stage or external image for which the builder has to wait, and the type, i.e. the reason why it has to wait for it

Jump to

Keyboard shortcuts

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