docker

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddImages added in v0.2.0

func AddImages(imgs ...*Image) error

AddImages adds images to the global set. It returns an error if there are any ID collisions.

func IterateImages added in v0.2.0

func IterateImages(f func(string, *Image))

IterateImages iterates over all images in the global set.

func NewClient added in v0.1.0

func NewClient() (*client.Client, error)

NewClient wraps the internal client.NewClientWithOpts function, which creates a new Docker client using the options provided. The default options used are the ones provided by client.FromEnv, and the API version negotiation is enabled.

Types

type Image

type Image struct {
	Config *ImageConfig
	// contains filtered or unexported fields
}

Image holds the information about a Docker image.

func FindImage added in v0.2.0

func FindImage(id string) (*Image, bool)

FindImage searches in the global set for an image ID and returns (*Image, true) if found. If not found it returns (nil, false).

func NewImage added in v0.1.0

func NewImage(m map[string]interface{}) (*Image, error)

NewImage creates an Image using the given configuration.

func (*Image) Build

func (i *Image) Build() (bool, error)

Build wraps the internal build function, it guarantees to construct the image only once by using sync.Once. If the image was already built, it returns (false, nil). If any error occurs, it returns (false, err). If the image was built succesfully, it returns (true, nil).

func (*Image) BuildDeps added in v0.3.0

func (i *Image) BuildDeps() error

BuildDeps builds all the images that are needed by the image. It runs as a DFS algorithm.

func (*Image) FullName

func (i *Image) FullName() string

FullName joins the registry with image name

func (*Image) FullNamesWithTags

func (i *Image) FullNamesWithTags() []string

FullNamesWithTags returns a list of strings, each string is the full name of the image with one of its tags.

func (*Image) Push

func (i *Image) Push() (bool, error)

Push wraps the internal push function, it guarantees to push the image only once by using sync.Once. If the image was already pushed, it returns (false, nil). If any error occurs, it returns (false, err). If the image was pushed succesfully, it returns (true, nil).

type ImageConfig added in v0.1.0

type ImageConfig struct {
	ID         string             `yaml:"id"`
	Name       string             `yaml:"name"`
	Tags       []string           `yaml:"tags"`
	Context    string             `yaml:"context"`
	Dockerfile string             `yaml:"dockerfile"`
	Target     string             `yaml:"target"`
	BuildArgs  map[string]*string `yaml:"buildArgs"`
	Registry   string             `yaml:"registry"`
	Needs      []string           `yaml:"needs"`
}

ImageConfig has all the configurations for a Docker image. They are defined in the bob.yaml file.

type ImagesSet added in v0.2.0

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

ImagesSet is a set of images. It maps image IDs to images.

func NewImagesSet added in v0.2.0

func NewImagesSet(images ...*Image) *ImagesSet

NewImagesSet returns a new instance of ImagesSet. You may pass initial images to the constructor.

func (*ImagesSet) AddImages added in v0.2.0

func (is *ImagesSet) AddImages(imgs ...*Image) error

AddImages adds images to the set. It returns an error if there are any ID collisions.

func (*ImagesSet) FindImage added in v0.2.0

func (is *ImagesSet) FindImage(id string) (*Image, bool)

FindImage searches for an image ID and returns (*Image, true) if found. If not found it returns (nil, false).

func (*ImagesSet) IterateImages added in v0.2.0

func (is *ImagesSet) IterateImages(f func(string, *Image))

IterateImages iterates over all images in the set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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