image

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateReference

func ValidateReference(ref string) error

ValidateReference checks if the image reference is valid. It ensures the reference follows Docker's image naming conventions.

Types

type ImageConfig

type ImageConfig struct {
	Ref          string
	BuildOptions *types.ImageBuildOptions
	PullOptions  *image.PullOptions
	PushOptions  *image.PushOptions
}

Image represents a Docker image and provides methods for setting pull and build options.

func NewConfig

func NewConfig(ref string) (*ImageConfig, error)

NewConfig creates a new Image configuration with the specified image reference. The Image instance contains pull, push, and build options for the Docker image.

func NewImageFromSrc

func NewImageFromSrc(dir string) (*ImageConfig, error)

NewImageFromSrc creates a new Image configuration from a source directory. The directory must contain a Dockerfile in its root. This is equivalent to running `docker build` with the specified directory as context.

Usage example:

img, err := image.NewImageFromSrc("./myapp")
if err != nil {
	return err
}
img.SetBuildOptions(
	imageoptions.SetTag("myapp:latest"),
	imageoptions.AddBuildArg("VERSION", "1.0.0"),
)

func (*ImageConfig) SetBuildOptions

func (img *ImageConfig) SetBuildOptions(setOFns ...imageoptions.SetBuildOptFn)

SetBuildOptions configures build options for the Docker image. Use this method to set various build options using functions from the imageoptions package.

func (*ImageConfig) SetPullOptions

func (img *ImageConfig) SetPullOptions(setOFns ...imageoptions.SetPullOptFn)

SetPullOptions configures pull options for the Docker image. Use this method to set various pull options using functions from the imageoptions package.

func (*ImageConfig) SetPushOptions

func (img *ImageConfig) SetPushOptions(setOFns ...imageoptions.SetPushOptFn)

SetPushOptions configures push options for the Docker image. Use this method to set various push options using functions from the imageoptions package.

func (*ImageConfig) String

func (img *ImageConfig) String() string

String returns the reference of the Docker image.

Jump to

Keyboard shortcuts

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