Documentation ¶
Index ¶
- Variables
- func BuildDockerImage(ctx context.Context, dockerFile string, cli MeliAPiClient) (string, error)
- func ConnectNetwork(ctx context.Context, networkID, containerID string, cli MeliAPiClient) error
- func ContainerLogs(ctx context.Context, containerId string, followLogs bool, cli MeliAPiClient) error
- func ContainerStart(ctx context.Context, containerId string, cli MeliAPiClient) error
- func CreateContainer(ctx context.Context, s ServiceConfig, ...) (bool, string, error)
- func CreateDockerVolume(ctx context.Context, name, driver string, cli MeliAPiClient) (string, error)
- func FormatComposePath(path string) []string
- func FormatContainerName(containerName string) string
- func FormatLabels(label string) []string
- func FormatPorts(port string) []string
- func FormatRegistryAuth(auth string) []string
- func FormatServiceVolumes(volume string) []string
- func GetAuth()
- func GetCwdName(path string) string
- func GetNetwork(ctx context.Context, networkName string, cli MeliAPiClient) (string, error)
- func PullDockerImage(ctx context.Context, imageName string, cli MeliAPiClient) error
- type Buildstruct
- type DockerComposeConfig
- type EmptyStruct
- type MeliAPiClient
- type MockDockerClient
- func (m *MockDockerClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (m *MockDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (m *MockDockerClient) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
- func (m *MockDockerClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
- func (m *MockDockerClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
- func (m *MockDockerClient) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
- func (m *MockDockerClient) NetworkConnect(ctx context.Context, networkID, containerID string, ...) error
- func (m *MockDockerClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
- func (m *MockDockerClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
- func (m *MockDockerClient) VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error)
- type ServiceConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var AuthInfo sync.Map
Functions ¶
func BuildDockerImage ¶
func ConnectNetwork ¶
func ConnectNetwork(ctx context.Context, networkID, containerID string, cli MeliAPiClient) error
func ContainerLogs ¶
func ContainerStart ¶
func ContainerStart(ctx context.Context, containerId string, cli MeliAPiClient) error
func CreateContainer ¶
func CreateContainer(ctx context.Context, s ServiceConfig, networkName, formattedImageName, dockerComposeFile string, cli MeliAPiClient) (bool, string, error)
func CreateDockerVolume ¶
func FormatComposePath ¶
func FormatContainerName ¶
func FormatLabels ¶
func FormatPorts ¶
func FormatRegistryAuth ¶
func FormatServiceVolumes ¶
func GetCwdName ¶
func GetNetwork ¶
GetNetwork gets or creates newtwork(if it doesn't exist yet.)
func PullDockerImage ¶
func PullDockerImage(ctx context.Context, imageName string, cli MeliAPiClient) error
Types ¶
type Buildstruct ¶
type DockerComposeConfig ¶
type DockerComposeConfig struct { Version string `yaml:"version,omitempty"` Services map[string]ServiceConfig `yaml:"services"` Volumes map[string]string `yaml:"volumes,omitempty"` }
type EmptyStruct ¶
type EmptyStruct struct{}
type MeliAPiClient ¶
type MeliAPiClient interface { // we implement this interface so that we can be able to mock it in tests // https://medium.com/@zach_4342/dependency-injection-in-golang-e587c69478a8 ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error) NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) }
type MockDockerClient ¶
type MockDockerClient struct{}
func (*MockDockerClient) ContainerCreate ¶
func (m *MockDockerClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
func (*MockDockerClient) ContainerList ¶
func (m *MockDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
func (*MockDockerClient) ContainerLogs ¶
func (m *MockDockerClient) ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
func (*MockDockerClient) ContainerStart ¶
func (m *MockDockerClient) ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
func (*MockDockerClient) ImageBuild ¶
func (m *MockDockerClient) ImageBuild(ctx context.Context, buildContext io.Reader, options types.ImageBuildOptions) (types.ImageBuildResponse, error)
func (*MockDockerClient) ImagePull ¶
func (m *MockDockerClient) ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
func (*MockDockerClient) NetworkConnect ¶
func (m *MockDockerClient) NetworkConnect(ctx context.Context, networkID, containerID string, config *network.EndpointSettings) error
func (*MockDockerClient) NetworkCreate ¶
func (m *MockDockerClient) NetworkCreate(ctx context.Context, name string, options types.NetworkCreate) (types.NetworkCreateResponse, error)
func (*MockDockerClient) NetworkList ¶
func (m *MockDockerClient) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error)
func (*MockDockerClient) VolumeCreate ¶
func (m *MockDockerClient) VolumeCreate(ctx context.Context, options volumetypes.VolumesCreateBody) (types.Volume, error)
type ServiceConfig ¶
type ServiceConfig struct { Image string `yaml:"image,omitempty"` Ports []string `yaml:"ports,omitempty"` Labels []string `yaml:"labels,omitempty"` Environment []string `yaml:"environment,omitempty"` Command string `yaml:"command,flow,omitempty"` Restart string `yaml:"restart,omitempty"` Build Buildstruct `yaml:"build,omitempty"` Volumes []string `yaml:"volumes,omitempty"` }
Click to show internal directories.
Click to hide internal directories.