|
@@ -14,12 +14,12 @@ import (
|
|
"golang.org/x/net/context"
|
|
"golang.org/x/net/context"
|
|
|
|
|
|
"github.com/docker/docker/api"
|
|
"github.com/docker/docker/api"
|
|
- "github.com/docker/docker/api/client"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/api/types/container"
|
|
"github.com/docker/docker/builder"
|
|
"github.com/docker/docker/builder"
|
|
"github.com/docker/docker/builder/dockerignore"
|
|
"github.com/docker/docker/builder/dockerignore"
|
|
"github.com/docker/docker/cli"
|
|
"github.com/docker/docker/cli"
|
|
|
|
+ "github.com/docker/docker/cli/command"
|
|
"github.com/docker/docker/opts"
|
|
"github.com/docker/docker/opts"
|
|
"github.com/docker/docker/pkg/archive"
|
|
"github.com/docker/docker/pkg/archive"
|
|
"github.com/docker/docker/pkg/fileutils"
|
|
"github.com/docker/docker/pkg/fileutils"
|
|
@@ -58,7 +58,7 @@ type buildOptions struct {
|
|
}
|
|
}
|
|
|
|
|
|
// NewBuildCommand creates a new `docker build` command
|
|
// NewBuildCommand creates a new `docker build` command
|
|
-func NewBuildCommand(dockerCli *client.DockerCli) *cobra.Command {
|
|
|
|
|
|
+func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
ulimits := make(map[string]*units.Ulimit)
|
|
ulimits := make(map[string]*units.Ulimit)
|
|
options := buildOptions{
|
|
options := buildOptions{
|
|
tags: opts.NewListOpts(validateTag),
|
|
tags: opts.NewListOpts(validateTag),
|
|
@@ -99,7 +99,7 @@ func NewBuildCommand(dockerCli *client.DockerCli) *cobra.Command {
|
|
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the build output and print image ID on success")
|
|
flags.BoolVarP(&options.quiet, "quiet", "q", false, "Suppress the build output and print image ID on success")
|
|
flags.BoolVar(&options.pull, "pull", false, "Always attempt to pull a newer version of the image")
|
|
flags.BoolVar(&options.pull, "pull", false, "Always attempt to pull a newer version of the image")
|
|
|
|
|
|
- client.AddTrustedFlags(flags, true)
|
|
|
|
|
|
+ command.AddTrustedFlags(flags, true)
|
|
|
|
|
|
return cmd
|
|
return cmd
|
|
}
|
|
}
|
|
@@ -120,7 +120,7 @@ func (out *lastProgressOutput) WriteProgress(prog progress.Progress) error {
|
|
return out.output.WriteProgress(prog)
|
|
return out.output.WriteProgress(prog)
|
|
}
|
|
}
|
|
|
|
|
|
-func runBuild(dockerCli *client.DockerCli, options buildOptions) error {
|
|
|
|
|
|
+func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
|
|
|
|
|
|
var (
|
|
var (
|
|
buildCtx io.ReadCloser
|
|
buildCtx io.ReadCloser
|
|
@@ -219,7 +219,7 @@ func runBuild(dockerCli *client.DockerCli, options buildOptions) error {
|
|
ctx := context.Background()
|
|
ctx := context.Background()
|
|
|
|
|
|
var resolvedTags []*resolvedTag
|
|
var resolvedTags []*resolvedTag
|
|
- if client.IsTrusted() {
|
|
|
|
|
|
+ if command.IsTrusted() {
|
|
// Wrap the tar archive to replace the Dockerfile entry with the rewritten
|
|
// Wrap the tar archive to replace the Dockerfile entry with the rewritten
|
|
// Dockerfile which uses trusted pulls.
|
|
// Dockerfile which uses trusted pulls.
|
|
buildCtx = replaceDockerfileTarWrapper(ctx, buildCtx, relDockerfile, dockerCli.TrustedReference, &resolvedTags)
|
|
buildCtx = replaceDockerfileTarWrapper(ctx, buildCtx, relDockerfile, dockerCli.TrustedReference, &resolvedTags)
|
|
@@ -319,7 +319,7 @@ func runBuild(dockerCli *client.DockerCli, options buildOptions) error {
|
|
fmt.Fprintf(dockerCli.Out(), "%s", buildBuff)
|
|
fmt.Fprintf(dockerCli.Out(), "%s", buildBuff)
|
|
}
|
|
}
|
|
|
|
|
|
- if client.IsTrusted() {
|
|
|
|
|
|
+ if command.IsTrusted() {
|
|
// Since the build was successful, now we must tag any of the resolved
|
|
// Since the build was successful, now we must tag any of the resolved
|
|
// images from the above Dockerfile rewrite.
|
|
// images from the above Dockerfile rewrite.
|
|
for _, resolved := range resolvedTags {
|
|
for _, resolved := range resolvedTags {
|
|
@@ -373,7 +373,7 @@ func rewriteDockerfileFrom(ctx context.Context, dockerfile io.Reader, translator
|
|
return nil, nil, err
|
|
return nil, nil, err
|
|
}
|
|
}
|
|
ref = reference.WithDefaultTag(ref)
|
|
ref = reference.WithDefaultTag(ref)
|
|
- if ref, ok := ref.(reference.NamedTagged); ok && client.IsTrusted() {
|
|
|
|
|
|
+ if ref, ok := ref.(reference.NamedTagged); ok && command.IsTrusted() {
|
|
trustedRef, err := translator(ctx, ref)
|
|
trustedRef, err := translator(ctx, ref)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, nil, err
|
|
return nil, nil, err
|