Documentation
¶
Index ¶
- Constants
- func AddDockerfileToBuildContext(dockerfileCtx io.ReadCloser, buildCtx io.ReadCloser) (io.ReadCloser, string, error)
- func Compress(buildCtx io.ReadCloser) (io.ReadCloser, error)
- func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, isArchive bool, err error)
- func GetContextFromGitURL(gitURL, dockerfileName string) (string, string, error)
- func GetContextFromLocalDir(localDir, dockerfileName string) (string, string, error)
- func GetContextFromReader(rc io.ReadCloser, dockerfileName string) (out io.ReadCloser, relDockerfile string, err error)
- func GetContextFromURL(out io.Writer, remoteURL, dockerfileName string) (io.ReadCloser, string, error)
- func IsArchive(header []byte) bool
- func ReadDockerignore(contextDir string) ([]string, error)
- func ResolveAndValidateContextPath(givenContextDir string) (string, error)
- func TrimBuildFilesFromExcludes(excludes []string, dockerfile string, dockerfileFromStdin bool) []string
- func ValidateContextDirectory(srcPath string, excludes []string) error
- func WriteTempDockerfile(rc io.ReadCloser) (dockerfileDir string, err error)
Constants ¶
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 ¶
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 ¶
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