docker

package
v0.0.0-...-a2f8807 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package docker contains utilities for interfacing with Docker (build/push).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(
	ctx context.Context,
	plugin *plugin.Plugin,
	imageName string,
	cachePath string,
	args []string,
) ([]byte, error)

Build runs a Docker build command for the specified plugin tagging it with the given image name. The args parameter passes any additional arguments to be passed to the build. Returns the combined stdout/stderr of the build along with any error.

func FindBaseImageDir

func FindBaseImageDir(basedir string) (string, error)

FindBaseImageDir looks for the .github/docker folder starting from basedir. It continues to search through parent directories till found (or at the root).

func ImageName

func ImageName(plugin *plugin.Plugin, org string) string

ImageName returns the name of the plugin's tagged image in the given organization.

func Push

func Push(ctx context.Context, plugin *plugin.Plugin, dockerOrg string) ([]byte, error)

Push pushes a docker image for the given plugin to the Docker organization. It assumes it has already been built in a previous step.

Types

type BaseImages

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

BaseImages contains state about the latest versions of base images in the .github/docker directory. These are automatically kept up to date by dependabot.

func LoadLatestBaseImages

func LoadLatestBaseImages(baseImageDir string) (_ *BaseImages, retErr error)

LoadLatestBaseImages returns the latest base image information from images found in the .github/docker directory.

func (*BaseImages) ImageNameAndVersion

func (b *BaseImages) ImageNameAndVersion(imageName string) string

ImageNameAndVersion returns the latest image name and version (if tracked in the .github/docker directory). For example, passing "debian" will return "debian:bookworm-yyyyMMdd" (where "yyyyMMdd" is the latest image date). If the image is not tracked in the .github/docker directory, returns an empty string. This is used to automate updating Dockerfile base image versions when fetching new versions of plugins.

func (*BaseImages) ImageVersion

func (b *BaseImages) ImageVersion(imageName string) string

ImageVersion returns the latest version for the image name (if tracked in the .github/docker directory). For example, passing "debian" will return "bookworm-yyyyMMdd" (where "yyyyMMdd" is the latest image date). If the image is not tracked in the .github/docker directory, returns an empty string.

Jump to

Keyboard shortcuts

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