package dockerfile2llb

import "github.com/moby/buildkit/frontend/dockerfile/dockerfile2llb"

Index

Constants

const (
	DefaultCopyImage = "docker/dockerfile-copy:v0.1.9@sha256:e8f159d3f00786604b93c675ee2783f8dc194bb565e61ca5788f6a6e9d304061"
)

Functions

func DetectSyntax

func DetectSyntax(r io.Reader) (string, string, []parser.Range, bool)

func ParseDirectives

func ParseDirectives(r io.Reader) map[string]Directive

func WithInternalName

func WithInternalName(name string) llb.ConstraintsOpt

Types

type ConvertOpt

type ConvertOpt struct {
	Target       string
	MetaResolver llb.ImageMetaResolver
	BuildArgs    map[string]string
	Labels       map[string]string
	SessionID    string
	BuildContext *llb.State
	Excludes     []string
	// IgnoreCache contains names of the stages that should not use build cache.
	// Empty slice means ignore cache for all stages. Nil doesn't disable cache.
	IgnoreCache []string
	// CacheIDNamespace scopes the IDs for different cache mounts
	CacheIDNamespace  string
	ImageResolveMode  llb.ResolveMode
	TargetPlatform    *ocispecs.Platform
	BuildPlatforms    []ocispecs.Platform
	PrefixPlatform    bool
	ExtraHosts        []llb.HostIP
	ShmSize           int64
	Ulimit            []pb.Ulimit
	CgroupParent      string
	ForceNetMode      pb.NetMode
	OverrideCopyImage string
	LLBCaps           *apicaps.CapSet
	ContextLocalName  string
	SourceMap         *llb.SourceMap
	Hostname          string
	Warn              func(short, url string, detail [][]byte, location *parser.Range)
	ContextByName     func(context.Context, string) (*llb.State, *Image, error)
}

type Directive

type Directive struct {
	Name     string
	Value    string
	Location []parser.Range
}

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 {
	ocispecs.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"`

	// Variant defines platform variant. To be added to OCI.
	Variant string `json:"variant,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, *binfotypes.BuildInfo, error)

type ImageConfig

type ImageConfig struct {
	ocispecs.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
}

ImageConfig is a docker compatible config for an image

Source Files

convert.go convert_norunsecurity.go convert_runmount.go convert_runnetwork.go convert_secrets.go convert_ssh.go defaultshell.go directives.go image.go platform.go

Version
v0.10.0-rc2
Published
Feb 25, 2022
Platform
js/wasm
Imports
35 packages
Last checked
4 minutes ago

Tools for package owners.