imagebuilder

package
v0.0.0-...-f12bd69 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidContextDir = errors.New("invalid context directory")
)

Functions

This section is empty.

Types

type DataParams

type DataParams struct {
	TargetPath string
}

type DockerfileBuildEngine

type DockerfileBuildEngine interface {
	Name() string
	Build(options DockerfileBuildOptions) error
}

type DockerfileBuildOptions

type DockerfileBuildOptions struct {
	Dockerfile   string
	BuildContext string
	IgnoreFile   string
	ImagePath    string
	BuildArgs    []NVParam
	Labels       map[string]string
	Target       string
	NetworkMode  string
	ExtraHosts   string //already a comma separated list
	CacheFrom    []string
	CacheTo      []string
	Platforms    []string
	OutputStream io.Writer
}

type HealthConfig

type HealthConfig struct {
	Test          []string      `json:",omitempty"`
	Interval      time.Duration `json:",omitempty"`
	Timeout       time.Duration `json:",omitempty"`
	StartPeriod   time.Duration `json:",omitempty"`
	StartInterval time.Duration `json:",omitempty"`
	Retries       int           `json:",omitempty"`
}

type History

type History struct {
	Created    string `json:"created,omitempty"`
	Author     string `json:"author,omitempty"`
	CreatedBy  string `json:"created_by,omitempty"`
	Comment    string `json:"comment,omitempty"`
	EmptyLayer bool   `json:"empty_layer,omitempty"`
}

type ImageConfig

type ImageConfig struct {
	Created      time.Time `json:"created,omitempty"`
	Author       string    `json:"author,omitempty"`
	Architecture string    `json:"architecture"`
	OS           string    `json:"os"`
	OSVersion    string    `json:"os.version,omitempty"`
	OSFeatures   []string  `json:"os.features,omitempty"`
	Variant      string    `json:"variant,omitempty"`
	Config       RunConfig `json:"config"`
	RootFS       *RootFS   `json:"rootfs"` //not used building images
	History      []History `json:"history,omitempty"`
	AddHistory   []History `json:"add_history,omitempty"` //extra field
	//Extra fields
	Container     string `json:"container,omitempty"`
	DockerVersion string `json:"docker_version,omitempty"`
	//More extra fields
	ID      string `json:"id,omitempty"`
	Comment string `json:"comment,omitempty"`
}

ImageConfig describes the container image configurations (aka ConfigFile or V1Image/Image in other libraries) Fields (ordered according to spec): * https://github.com/opencontainers/image-spec/blob/main/config.md#properties * https://github.com/moby/moby/blob/e1c92184f08153456ecbf5e302a851afd6f28e1c/image/image.go#LL40C6-L40C13 Note: related to pkg/docker/dockerimage/V1ConfigObject|ConfigObject TODO: refactor into one set of common structs later

type ImageResult

type ImageResult struct {
	ID        string   `json:"id,omitempty"`
	Digest    string   `json:"digest,omitempty"`
	Name      string   `json:"name,omitempty"`
	OtherTags []string `json:"other_tags,omitempty"`
}

type LayerDataInfo

type LayerDataInfo struct {
	Type            LayerSourceType
	Source          string
	Params          *DataParams
	EntrypointLayer bool
	ResetCmd        bool
}

type LayerSourceType

type LayerSourceType string
const (
	TarSource      LayerSourceType = "lst.tar"
	DirSource      LayerSourceType = "lst.dir"
	FileSource     LayerSourceType = "lst.file"
	FileListSource LayerSourceType = "lst.file_list"
)

type NVParam

type NVParam struct {
	Name  string
	Value string
}

type RootFS

type RootFS struct {
	Type    string   `json:"type"`
	DiffIDs []string `json:"diff_ids,omitempty"`
}

type RunConfig

type RunConfig struct {
	User               string              `json:"User,omitempty"`
	ExposedPorts       map[string]struct{} `json:"ExposedPorts,omitempty"`
	AddExposedPorts    map[string]struct{} `json:"AddExposedPorts,omitempty"`    //extra field
	RemoveExposedPorts []string            `json:"RemoveExposedPorts,omitempty"` //extra field
	Env                []string            `json:"Env,omitempty"`
	AddEnv             []string            `json:"AddEnv,omitempty"` //extra field
	Entrypoint         []string            `json:"Entrypoint,omitempty"`
	IsShellEntrypoint  bool                `json:"IsShellEntrypoint,omitempty"` //extra field
	Cmd                []string            `json:"Cmd,omitempty"`
	IsShellCmd         bool                `json:"IsShellCmd,omitempty"` //extra field
	Volumes            map[string]struct{} `json:"Volumes,omitempty"`
	AddVolumes         map[string]struct{} `json:"AddVolumes,omitempty"` //extra field
	WorkingDir         string              `json:"WorkingDir,omitempty"`
	Labels             map[string]string   `json:"Labels,omitempty"`
	AddLabels          map[string]string   `json:"AddLabels,omitempty"` //extra field
	StopSignal         string              `json:"StopSignal,omitempty"`
	ArgsEscaped        bool                `json:"ArgsEscaped,omitempty"`
	Healthcheck        *HealthConfig       `json:"Healthcheck,omitempty"`
	//Extra fields
	AttachStderr    bool     `json:"AttachStderr,omitempty"`
	AttachStdin     bool     `json:"AttachStdin,omitempty"`
	AttachStdout    bool     `json:"AttachStdout,omitempty"`
	Domainname      string   `json:"Domainname,omitempty"`
	Hostname        string   `json:"Hostname,omitempty"`
	Image           string   `json:"Image,omitempty"`
	OnBuild         []string `json:"OnBuild,omitempty"`
	OpenStdin       bool     `json:"OpenStdin,omitempty"`
	StdinOnce       bool     `json:"StdinOnce,omitempty"`
	Tty             bool     `json:"Tty,omitempty"`
	NetworkDisabled bool     `json:"NetworkDisabled,omitempty"`
	MacAddress      string   `json:"MacAddress,omitempty"`
	StopTimeout     *int     `json:"StopTimeout,omitempty"`
	Shell           []string `json:"Shell,omitempty"`
}

RunConfig describes the runtime config parameters for container instances (aka Config in other libraries) Fields (ordered according to spec): Memory, MemorySwap, CpuShares aren't necessary * https://github.com/opencontainers/image-spec/blob/main/config.md#properties (Config field) * https://github.com/moby/moby/blob/master/api/types/container/config.go#L70 Note: related to pkg/docker/dockerimage/ContainerConfig TODO: refactor into one set of common structs later

type SimpleBuildEngine

type SimpleBuildEngine interface {
	Name() string
	Build(options SimpleBuildOptions) (*ImageResult, error)
}

type SimpleBuildOptions

type SimpleBuildOptions struct {
	From             string
	FromTar          string
	Tags             []string
	Layers           []LayerDataInfo
	ImageConfig      *ImageConfig
	HideBuildHistory bool
	OutputImageTar   string
}

func SimpleBuildOptionsFromDockerfile

func SimpleBuildOptionsFromDockerfile(path string, ignoreExeInstructions bool) (*SimpleBuildOptions, error)

func SimpleBuildOptionsFromDockerfileData

func SimpleBuildOptionsFromDockerfileData(data string, ignoreExeInstructions bool) (*SimpleBuildOptions, error)

func SimpleBuildOptionsFromImageConfig

func SimpleBuildOptionsFromImageConfig(data *ImageConfig) (*SimpleBuildOptions, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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