container

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeChecksum

func ComputeChecksum(data []byte) string

TODO: provide a shorter checksum

func GetEnv

func GetEnv(key string) string

func Getenv

func Getenv(key string) string

func ParseImageTag

func ParseImageTag(imageTag string) (string, string)

func SumChecksum added in v0.5.1

func SumChecksum(sums ...[]byte) string

func TarDir added in v0.5.1

func TarDir(src fs.ReadDirFS) (*bytes.Buffer, error)

Types

type Build

type Build struct {
	Leader             Leader
	Platform           types.Platform
	Custom             Custom
	Registries         map[string]*protos2.ContainerRegistry
	Folder             string
	App                string    `json:"app"`
	Image              string    `json:"image"`
	BuildType          BuildType `json:"build_type"`
	Runtime            utils.RuntimeType
	Organization       string
	ImageTag           string `json:"image_tag"`
	Registry           string
	ContainifyRegistry string
	Env                EnvType
	File               string
	Repository         string
	SourcePackages     []string
	SourceFiles        []string
	Verbose            bool
	// contains filtered or unexported fields
}

TODO: add target container platform

func InitRuntime

func InitRuntime(build *Build) *Build

func NewBuild

func NewBuild(build *Build) *Build

func NewGoServiceBuild

func NewGoServiceBuild(appName string) Build

func NewMavenServiceBuild

func NewMavenServiceBuild(appName string) Build

func NewPythonServiceBuild

func NewPythonServiceBuild(appName string) Build

func NewServiceBuild

func NewServiceBuild(appName string, buildType BuildType) Build

func (*Build) AsFlags

func (b *Build) AsFlags() []string

func (*Build) CustomString added in v0.4.0

func (b *Build) CustomString(key string) string

func (*Build) Defaults

func (b *Build) Defaults() *Build

func (*Build) ImageURI

func (b *Build) ImageURI() string

type BuildGroup added in v0.11.0

type BuildGroup struct {
	Builds []*Build
}

type BuildGroups added in v0.11.0

type BuildGroups []*BuildGroup

type BuildType

type BuildType string
const (
	GoLang  BuildType = "GoLang"
	Maven   BuildType = "Maven"
	Python  BuildType = "Python"
	Generic BuildType = "Generic"
)

func (*BuildType) Set

func (e *BuildType) Set(v string) error

Set must have pointer receiver so it doesn't change the value of a copy

func (*BuildType) String

func (e *BuildType) String() string

String is used both by fmt.Print and by Cobra in help text

func (*BuildType) Type

func (e *BuildType) Type() string

Type is only used in help text

type Container

type Container struct {
	Source  fs.ReadDirFS
	Build   *Build
	ID      string
	Name    string
	Image   string
	Env     EnvType
	Prefix  string
	Opts    types.ContainerConfig
	Verbose bool
	// contains filtered or unexported fields
}

func New

func New(build Build) *Container

func (*Container) Apply

func (c *Container) Apply(opts *types.ContainerConfig)

func (*Container) BuildImage

func (c *Container) BuildImage(dockerfile []byte, imageName string) error

func (*Container) BuildImageByPlatform

func (c *Container) BuildImageByPlatform(dockerfile []byte, imageName string, platform string) error

func (*Container) BuildImageByPlatforms

func (c *Container) BuildImageByPlatforms(dockerfile []byte, dockerCtx *bytes.Buffer, imageName string, platforms []string) ([]string, error)

func (*Container) BuildIntermidiateContainer

func (c *Container) BuildIntermidiateContainer(image string, dockerFile []byte, platforms ...string) error

func (*Container) BuildingContainer

func (c *Container) BuildingContainer(opts types.ContainerConfig) error

func (*Container) Commit

func (c *Container) Commit(imageTag string, comment string, changes ...string) (string, error)

func (*Container) CopyContentTo

func (c *Container) CopyContentTo(content, dest string) error

func (*Container) CopyDirectoryTo

func (c *Container) CopyDirectoryTo(srcPath, dstPath string) error

TODO: ignore hidden folder and files maybe support .dockerignore file or more .dockerinclude file to include folder and files that are ignored by default

func (*Container) CopyFileFromContainer

func (c *Container) CopyFileFromContainer(srcPath string) (string, error)

CopyFileFromContainer reads a single file from a container and returns its content as a string.

func (*Container) CopyFileTo

func (c *Container) CopyFileTo(srcPath, destPath string) error

func (*Container) Create

func (c *Container) Create(opts types.ContainerConfig) error

func (*Container) Exec

func (c *Container) Exec(cmd ...string) error

func (*Container) GetBuild added in v0.11.0

func (c *Container) GetBuild() *Build

func (*Container) ImageExists

func (c *Container) ImageExists(imageName string, platforms ...string) (bool, error)

imageExists checks if the image with the specified tag exists.

func (*Container) Inspect

func (c *Container) Inspect() (*types.ContainerConfig, error)

func (*Container) InspectImage

func (c *Container) InspectImage(image string) (*types.ImageInfo, error)

func (*Container) Pull

func (c *Container) Pull(imageTags ...string) error

func (*Container) PullByPlatform

func (c *Container) PullByPlatform(platform string, imageTags ...string) error

func (*Container) PullDefault

func (c *Container) PullDefault(imageTags ...string) error

func (*Container) Push

func (c *Container) Push(source, target string, opts ...PushOption) error

TODO: find a better way to provide optional parameters like PushOption

func (*Container) Ready

func (c *Container) Ready() error

func (*Container) Start

func (c *Container) Start() error

func (*Container) Stop

func (c *Container) Stop() error

func (*Container) Tag

func (c *Container) Tag(source, target string) error

func (*Container) Wait

func (c *Container) Wait() error

type Custom added in v0.10.0

type Custom map[string][]string

func (Custom) Bool added in v0.10.0

func (c Custom) Bool(key string) bool

func (Custom) String added in v0.10.0

func (c Custom) String(key string) string

func (Custom) Strings added in v0.10.0

func (c Custom) Strings(key string) []string

func (Custom) UInt added in v0.10.0

func (c Custom) UInt(key string) uint

type EnvType

type EnvType string
const (
	LocalEnv EnvType = "local"
	BuildEnv EnvType = "build"
	ProdEnv  EnvType = "production"
)

func (*EnvType) Set

func (e *EnvType) Set(v string) error

Set must have pointer receiver so it doesn't change the value of a copy

func (*EnvType) String

func (e *EnvType) String() string

String is used both by fmt.Print and by Cobra in help text

func (*EnvType) Type

func (e *EnvType) Type() string

Type is only used in help text

type Leader added in v0.11.0

type Leader interface {
	Leader(id string, fnc func() error)
}

type PushOption

type PushOption struct {
	Remove bool
}

Jump to

Keyboard shortcuts

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