dockerfile2llb

package
v0.0.0-...-ab06b26 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertOpt

type ConvertOpt struct {
	Target       string
	MetaResolver llb.ImageMetaResolver
	BuildArgs    map[string]string
	SessionID    string
	BuildContext *llb.State
	Excludes     []string
}

type HealthConfig

type HealthConfig struct {
	// Test is the test to perform to check that the container is healthy.
	// An empty slice means to inherit the default.
	// The options are:
	// {} : inherit healthcheck
	// {"NONE"} : disable healthcheck
	// {"CMD", args...} : exec arguments directly
	// {"CMD-SHELL", command} : run command with system's default shell
	Test []string `json:",omitempty"`

	// Zero means to inherit. Durations are expressed as integer nanoseconds.
	Interval    time.Duration `json:",omitempty"` // Interval is the time to wait between checks.
	Timeout     time.Duration `json:",omitempty"` // Timeout is the time to wait before considering the check to have hung.
	StartPeriod time.Duration `json:",omitempty"` // The start period for the container to initialize before the retries starts to count down.

	// Retries is the number of consecutive failures needed to consider a container as unhealthy.
	// Zero means inherit.
	Retries int `json:",omitempty"`
}

HealthConfig holds configuration settings for the HEALTHCHECK feature.

type Image

type Image struct {
	ocispec.Image

	// Config defines the execution parameters which should be used as a base when running a container using the image.
	Config ImageConfig `json:"config,omitempty"`
}

Image is the JSON structure which describes some basic information about the image. This provides the `application/vnd.oci.image.config.v1+json` mediatype when marshalled to JSON.

func Dockerfile2LLB

func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State, *Image, error)

type ImageConfig

type ImageConfig struct {
	ocispec.ImageConfig

	Healthcheck *HealthConfig `json:",omitempty"` // Healthcheck describes how to check the container is healthy
	ArgsEscaped bool          `json:",omitempty"` // True if command is already escaped (Windows specific)

	//	NetworkDisabled bool                `json:",omitempty"` // Is network disabled
	//	MacAddress      string              `json:",omitempty"` // Mac Address of the container
	OnBuild     []string          // ONBUILD metadata that were defined on the image Dockerfile
	StopTimeout *int              `json:",omitempty"` // Timeout (in seconds) to stop a container
	Shell       strslice.StrSlice `json:",omitempty"` // Shell for shell-form of RUN, CMD, ENTRYPOINT
}

type ShellLex

type ShellLex struct {
	// contains filtered or unexported fields
}

ShellLex performs shell word splitting and variable expansion.

ShellLex takes a string and an array of env variables and process all quotes (" and ') as well as $xxx and ${xxx} env variable tokens. Tries to mimic bash shell process. It doesn't support all flavors of ${xx:...} formats but new ones can be added by adding code to the "special ${} format processing" section

func NewShellLex

func NewShellLex(escapeToken rune) *ShellLex

NewShellLex creates a new ShellLex which uses escapeToken to escape quotes.

func (*ShellLex) ProcessWord

func (s *ShellLex) ProcessWord(word string, env []string) (string, error)

ProcessWord will use the 'env' list of environment variables, and replace any env var references in 'word'.

func (*ShellLex) ProcessWords

func (s *ShellLex) ProcessWords(word string, env []string) ([]string, error)

ProcessWords will use the 'env' list of environment variables, and replace any env var references in 'word' then it will also return a slice of strings which represents the 'word' split up based on spaces - taking into account quotes. Note that this splitting is done **after** the env var substitutions are done. Note, each one is trimmed to remove leading and trailing spaces (unless they are quoted", but ProcessWord retains spaces between words.

Jump to

Keyboard shortcuts

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