docker

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MPL-2.0 Imports: 39 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Options = []sdk.Option{
	sdk.WithComponents(&Builder{}, &Registry{}, &Platform{}),
}

Options are the SDK options to use for instantiation.

Functions

This section is empty.

Types

type Builder

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

Builder uses `docker build` to build a Docker iamge.

func (*Builder) Build

func (b *Builder) Build(
	ctx context.Context,
	ui terminal.UI,
	src *component.Source,
) (*Image, error)

Build

func (*Builder) BuildFunc

func (b *Builder) BuildFunc() interface{}

BuildFunc implements component.Builder

func (*Builder) Config

func (b *Builder) Config() (interface{}, error)

Config implements Configurable

func (*Builder) Documentation

func (b *Builder) Documentation() (*docs.Documentation, error)

type BuilderConfig

type BuilderConfig struct {
	// Control whether or not to inject the entrypoint binary into the resulting image
	DisableCEB bool `hcl:"disable_entrypoint,optional"`

	// Controls whether or not the image should be build with buildkit or docker v1
	UseBuildKit bool `hcl:"buildkit,optional"`

	// The name/path to the Dockerfile if it is not the root of the project
	Dockerfile string `hcl:"dockerfile,optional"`
}

Config is the configuration structure for the registry.

type ClientConfig added in v0.1.3

type ClientConfig struct {
	// Host to use when connecting to Docker
	// This can be used to connect to remote Docker instances
	Host string `hcl:"host,optional"`

	// Path to load the certificates for the Docker Engine
	CertPath string `hcl:"cert_path,optional"`

	// Docker API version to use for connection
	APIVersion string `hcl:"api_version,optional"`
}

type Config

type Config struct {
	// Image is the name of the image plus tag that the image will be pushed as.
	Image string `hcl:"image,attr"`

	// Tag is the tag to apply to the image.
	Tag string `hcl:"tag,attr"`

	// Local if true will not push this image to a remote registry.
	Local bool `hcl:"local,optional"`

	// The docker specific encoded authentication string to use to talk to the registry.
	EncodedAuth string `hcl:"encoded_auth,optional"`
}

Config is the configuration structure for the registry.

type Deployment

type Deployment struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Container            string   `protobuf:"bytes,3,opt,name=container,proto3" json:"container,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Deployment) Descriptor

func (*Deployment) Descriptor() ([]byte, []int)

func (*Deployment) GetContainer

func (m *Deployment) GetContainer() string

func (*Deployment) GetId

func (m *Deployment) GetId() string

func (*Deployment) GetName

func (m *Deployment) GetName() string

func (*Deployment) ProtoMessage

func (*Deployment) ProtoMessage()

func (*Deployment) Reset

func (m *Deployment) Reset()

func (*Deployment) String

func (m *Deployment) String() string

func (*Deployment) XXX_DiscardUnknown

func (m *Deployment) XXX_DiscardUnknown()

func (*Deployment) XXX_Marshal

func (m *Deployment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Deployment) XXX_Merge

func (m *Deployment) XXX_Merge(src proto.Message)

func (*Deployment) XXX_Size

func (m *Deployment) XXX_Size() int

func (*Deployment) XXX_Unmarshal

func (m *Deployment) XXX_Unmarshal(b []byte) error

type Image

type Image struct {
	Image                string   `protobuf:"bytes,1,opt,name=image,proto3" json:"image,omitempty"`
	Tag                  string   `protobuf:"bytes,2,opt,name=tag,proto3" json:"tag,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Image is the artifact type for the registry.

func (*Image) Descriptor

func (*Image) Descriptor() ([]byte, []int)

func (*Image) GetImage

func (m *Image) GetImage() string

func (*Image) GetTag

func (m *Image) GetTag() string

func (*Image) Name

func (i *Image) Name() string

Name is the full name including the tag.

func (*Image) ProtoMessage

func (*Image) ProtoMessage()

func (*Image) Reset

func (m *Image) Reset()

func (*Image) String

func (m *Image) String() string

func (*Image) XXX_DiscardUnknown

func (m *Image) XXX_DiscardUnknown()

func (*Image) XXX_Marshal

func (m *Image) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Image) XXX_Merge

func (m *Image) XXX_Merge(src proto.Message)

func (*Image) XXX_Size

func (m *Image) XXX_Size() int

func (*Image) XXX_Unmarshal

func (m *Image) XXX_Unmarshal(b []byte) error

type Platform

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

Platform is the Platform implementation for Docker.

func (*Platform) Auth

func (p *Platform) Auth() error

func (*Platform) AuthFunc

func (p *Platform) AuthFunc() interface{}

AuthFunc implements component.Authenticator

func (*Platform) Config

func (p *Platform) Config() (interface{}, error)

Config implements Configurable

func (*Platform) Deploy

func (p *Platform) Deploy(
	ctx context.Context,
	log hclog.Logger,
	src *component.Source,
	job *component.JobInfo,
	img *Image,
	deployConfig *component.DeploymentConfig,
	ui terminal.UI,
) (*Deployment, error)

Deploy deploys an image to Docker.

func (*Platform) DeployFunc

func (p *Platform) DeployFunc() interface{}

DeployFunc implements component.Platform

func (*Platform) Destroy

func (p *Platform) Destroy(
	ctx context.Context,
	log hclog.Logger,
	deployment *Deployment,
	ui terminal.UI,
) error

Destroy deletes the K8S deployment.

func (*Platform) DestroyFunc

func (p *Platform) DestroyFunc() interface{}

DestroyFunc implements component.Destroyer

func (*Platform) Documentation

func (p *Platform) Documentation() (*docs.Documentation, error)

func (*Platform) ValidateAuth

func (p *Platform) ValidateAuth() error

func (*Platform) ValidateAuthFunc

func (p *Platform) ValidateAuthFunc() interface{}

ValidateAuthFunc implements component.Authenticator

type PlatformConfig

type PlatformConfig struct {
	// A list of folders to mount to the container.
	Binds []string `hcl:"binds,optional"`

	// ClientConfig allow the user to specify the connection to the Docker
	// engine. By default we try to load this from env vars:
	// DOCKER_HOST to set the url to the docker server.
	// DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest.
	// DOCKER_CERT_PATH to load the TLS certificates from.
	// DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default.
	ClientConfig *ClientConfig `hcl:"client_config,block"`

	// The command to run in the container. This is an array of arguments
	// that are executed directly. These are not executed in the context of
	// a shell. If you want to use a shell, add that to this command manually.
	Command []string `hcl:"command,optional"`

	// Force pull the image from the remote repository
	ForcePull bool `hcl:"force_pull,optional"`

	// A map of key/value pairs, stored in docker as a string. Each key/value pair must
	// be unique. Validiation occurs at the docker layer, not in Waypoint. Label
	// keys are alphanumeric strings which may contain periods (.) and hyphens (-).
	// See the docker docs for more info: https://docs.docker.com/config/labels-custom-metadata/
	Labels map[string]string `hcl:"labels,optional"`

	// An array of strings with network names to connect the container to
	Networks []string `hcl:"networks,optional"`

	// A map of resources to configure the container with such as memory and cpu
	// limits.
	Resources map[string]string `hcl:"resources,optional"`

	// A path to a directory that will be created for the service to store
	// temporary data.
	ScratchSpace string `hcl:"scratch_path,optional"`

	// Environment variables that are meant to configure the application in a static
	// way. This might be control an image that has mulitple modes of operation,
	// selected via environment variable. Most configuration should use the waypoint
	// config commands.
	StaticEnvVars map[string]string `hcl:"static_environment,optional"`

	// Port that your service is running on within the actual container.
	// Defaults to port 3000.
	// TODO Evaluate if this should remain as a default 3000, should be a required field,
	// or default to another port.
	ServicePort uint `hcl:"service_port,optional"`
}

Config is the configuration structure for the Platform.

type Registry

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

Registry represents access to a Docker registry.

func (*Registry) Config

func (r *Registry) Config() (interface{}, error)

Config implements Configurable

func (*Registry) Documentation

func (r *Registry) Documentation() (*docs.Documentation, error)

func (*Registry) Push

func (r *Registry) Push(
	ctx context.Context,
	img *Image,
	ui terminal.UI,
	log hclog.Logger,
) (*Image, error)

Push pushes an image to the registry.

func (*Registry) PushFunc

func (r *Registry) PushFunc() interface{}

PushFunc implements component.Registry

type Release

type Release struct {
	Url                  string   `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Release) Descriptor

func (*Release) Descriptor() ([]byte, []int)

func (*Release) GetUrl

func (m *Release) GetUrl() string

func (*Release) ProtoMessage

func (*Release) ProtoMessage()

func (*Release) Reset

func (m *Release) Reset()

func (*Release) String

func (m *Release) String() string

func (*Release) XXX_DiscardUnknown

func (m *Release) XXX_DiscardUnknown()

func (*Release) XXX_Marshal

func (m *Release) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Release) XXX_Merge

func (m *Release) XXX_Merge(src proto.Message)

func (*Release) XXX_Size

func (m *Release) XXX_Size() int

func (*Release) XXX_Unmarshal

func (m *Release) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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