build

package
v28.3.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 22 Imported by: 208

Documentation

Index

Constants

View Source
const (
	// DefaultDockerfileName is the Default filename with Docker commands, read by docker build
	DefaultDockerfileName string = "Dockerfile"
)

Variables

This section is empty.

Functions

func AddDockerfileToBuildContext

func AddDockerfileToBuildContext(dockerfileCtx io.ReadCloser, buildCtx io.ReadCloser) (io.ReadCloser, string, error)

AddDockerfileToBuildContext from a ReadCloser, returns a new archive and the relative path to the dockerfile in the context.

func Compress

func Compress(buildCtx io.ReadCloser) (io.ReadCloser, error)

Compress the build context for sending to the API

func DetectArchiveReader

func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, isArchive bool, err error)

DetectArchiveReader detects whether the input stream is an archive or a Dockerfile and returns a buffered version of input, safe to consume in lieu of input. If an archive is detected, isArchive is set to true, and to false otherwise, in which case it is safe to assume input represents the contents of a Dockerfile.

func GetContextFromGitURL

func GetContextFromGitURL(gitURL, dockerfileName string) (string, string, error)

GetContextFromGitURL uses a Git URL as context for a `docker build`. The git repo is cloned into a temporary directory used as the context directory. Returns the absolute path to the temporary context directory, the relative path of the dockerfile in that context directory, and a non-nil error on success.

func GetContextFromLocalDir

func GetContextFromLocalDir(localDir, dockerfileName string) (string, string, error)

GetContextFromLocalDir uses the given local directory as context for a `docker build`. Returns the absolute path to the local context directory, the relative path of the dockerfile in that context directory, and a non-nil error on success.

func GetContextFromReader

func GetContextFromReader(rc io.ReadCloser, dockerfileName string