Files
docker-cli/components/engine/integration-cli/cli/build/build.go
Vincent Demeester 9210b1bdbd Introduce a cli package for test-integration
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 50c4475df6304e0cf12ea95217eb00ab5d572e34
Component: engine
2017-03-23 18:35:22 +01:00

32 lines
789 B
Go

package build
import (
"strings"
icmd "github.com/docker/docker/pkg/testutil/cmd"
)
// WithDockerfile creates / returns a CmdOperator to set the Dockerfile for a build operation
func WithDockerfile(dockerfile string) func(*icmd.Cmd) func() {
return func(cmd *icmd.Cmd) func() {
cmd.Command = append(cmd.Command, "-")
cmd.Stdin = strings.NewReader(dockerfile)
return nil
}
}
// WithoutCache makes the build ignore cache
func WithoutCache(cmd *icmd.Cmd) func() {
cmd.Command = append(cmd.Command, "--no-cache")
return nil
}
// WithContextPath set the build context path
func WithContextPath(path string) func(*icmd.Cmd) func() {
// WithContextPath sets the build context path
return func(cmd *icmd.Cmd) func() {
cmd.Command = append(cmd.Command, path)
return nil
}
}