exec

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Package exec provides an interface to execute certain commands.

Index

Constants

This section is empty.

Variables

View Source
var ErrDockerCommandNotFound = errors.New("docker: command not found")

ErrDockerCommandNotFound means the docker command is not found.

Functions

This section is empty.

Types

type BuildArguments

type BuildArguments struct {
	URI            string            // Required. Location of ECR Repo. Used to generate image name in conjunction with tag.
	ImageTag       string            // Required. Tag to pass to `docker build` via -t flag. Usually Git commit short ID.
	Dockerfile     string            // Required. Dockerfile to pass to `docker build` via --file flag.
	Context        string            // Optional. Build context directory to pass to `docker build`
	Target         string            // Optional. The target build stage to pass to `docker build`
	CacheFrom      []string          // Optional. Images to consider as cache sources to pass to `docker build`
	Args           map[string]string // Optional. Build args to pass via `--build-arg` flags. Equivalent to ARG directives in dockerfile.
	AdditionalTags []string          // Optional. Additional image tags to pass to docker.
}

BuildArguments holds the arguments we can pass in as flags from the manifest.

type DockerCommand

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

DockerCommand represents docker commands that can be run.

func NewDockerCommand

func NewDockerCommand() DockerCommand

NewDockerCommand returns a DockerCommand.

func (DockerCommand) Build

func (c DockerCommand) Build(in *BuildArguments) error

Build will run a `docker build` command with the input uri, tag, and Dockerfile path.

func (DockerCommand) CheckDockerEngineRunning

func (c DockerCommand) CheckDockerEngineRunning() error

CheckDockerEngineRunning will run `docker info` command to check if the docker engine is running.

func (DockerCommand) Login

func (c DockerCommand) Login(uri, username, password string) error

Login will run a `docker login` command against the Service repository URI with the input uri and auth data.

func (DockerCommand) Push

func (c DockerCommand) Push(uri, imageTag string, additionalTags ...string) error

Push will run `docker push` command against the repository URI with the input uri and image tags.

type Dockerfile

type Dockerfile struct {
	ExposedPorts []portConfig
	HealthCheck  *HealthCheck
	// contains filtered or unexported fields
}

Dockerfile represents a parsed Dockerfile.

func NewDockerfile

func NewDockerfile(fs afero.Fs, path string) *Dockerfile

NewDockerfile returns an empty Dockerfile.

func (*Dockerfile) GetExposedPorts

func (df *Dockerfile) GetExposedPorts() ([]uint16, error)

GetExposedPorts returns a uint16 slice of exposed ports found in the Dockerfile.

func (*Dockerfile) GetHealthCheck

func (df *Dockerfile) GetHealthCheck() (*HealthCheck, error)

GetHealthCheck parses the HEALTHCHECK instruction from the Dockerfile and returns it. If the HEALTHCHECK is NONE or there is no instruction, returns nil.

type ErrDockerDaemonNotResponsive

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

ErrDockerDaemonNotResponsive means the docker daemon is not responsive.

func (ErrDockerDaemonNotResponsive) Error

type ErrInvalidPort

type ErrInvalidPort struct {
	Match string
}

ErrInvalidPort means that while there was a port provided, it was out of bounds or unparseable

func (ErrInvalidPort) Error

func (e ErrInvalidPort) Error() string

type ErrNoExpose

type ErrNoExpose struct {
	Dockerfile string
}

ErrNoExpose means there were no documented EXPOSE statements in the given dockerfile.

func (ErrNoExpose) Error

func (e ErrNoExpose) Error() string

type HealthCheck

type HealthCheck struct {
	Interval    time.Duration
	Timeout     time.Duration
	StartPeriod time.Duration
	Retries     int
	Cmd         []string
}

HealthCheck represents health check options for a Dockerfile.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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