mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Remove daemon.BuildImageWithOut and use cli helpers function
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
@@ -2,7 +2,6 @@ package daemon // import "github.com/docker/docker/integration-cli/daemon"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -88,19 +87,6 @@ func (d *Daemon) inspectFieldWithError(name, field string) (string, error) {
|
||||
return d.inspectFilter(name, fmt.Sprintf(".%s", field))
|
||||
}
|
||||
|
||||
// BuildImageWithOut builds an image with the specified dockerfile and options and returns the output
|
||||
func (d *Daemon) BuildImageWithOut(name, dockerfile string, useCache bool, buildFlags ...string) (string, int, error) {
|
||||
buildCmd := BuildImageCmdWithHost(d.dockerBinary, name, dockerfile, d.Sock(), useCache, buildFlags...)
|
||||
result := icmd.RunCmd(icmd.Cmd{
|
||||
Command: buildCmd.Args,
|
||||
Env: buildCmd.Env,
|
||||
Dir: buildCmd.Dir,
|
||||
Stdin: buildCmd.Stdin,
|
||||
Stdout: buildCmd.Stdout,
|
||||
})
|
||||
return result.Combined(), result.ExitCode, result.Error
|
||||
}
|
||||
|
||||
// CheckActiveContainerCount returns the number of active containers
|
||||
// FIXME(vdemeester) should re-use ActivateContainers in some way
|
||||
func (d *Daemon) CheckActiveContainerCount(c *check.C) (interface{}, check.CommentInterface) {
|
||||
@@ -155,22 +141,3 @@ func WaitInspectWithArgs(dockerBinary, name, expr, expected string, timeout time
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// BuildImageCmdWithHost create a build command with the specified arguments.
|
||||
// Deprecated
|
||||
// FIXME(vdemeester) move this away
|
||||
func BuildImageCmdWithHost(dockerBinary, name, dockerfile, host string, useCache bool, buildFlags ...string) *exec.Cmd {
|
||||
args := []string{}
|
||||
if host != "" {
|
||||
args = append(args, "--host", host)
|
||||
}
|
||||
args = append(args, "build", "-t", name)
|
||||
if !useCache {
|
||||
args = append(args, "--no-cache")
|
||||
}
|
||||
args = append(args, buildFlags...)
|
||||
args = append(args, "-")
|
||||
buildCmd := exec.Command(dockerBinary, args...)
|
||||
buildCmd.Stdin = strings.NewReader(dockerfile)
|
||||
return buildCmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user