Merge pull request #27 from tiborvass/docker-ui

build: add more docker UI (context/dockerfile handling, iidfile, add-host, network)
This commit is contained in:
Tõnis Tiigi
2019-04-16 22:05:27 -07:00
committed by GitHub
13 changed files with 935 additions and 53 deletions

View File

@ -24,19 +24,19 @@ type buildOptions struct {
labels []string
buildArgs []string
cacheFrom []string
target string
platforms []string
secrets []string
ssh []string
outputs []string
cacheFrom []string
target string
platforms []string
secrets []string
ssh []string
outputs []string
imageIDFile string
extraHosts []string
networkMode string
// unimplemented
extraHosts []string
squash bool
quiet bool
networkMode string
imageIDFile string
squash bool
quiet bool
// hidden
// untrusted bool
@ -62,21 +62,12 @@ type commonOptions struct {
}
func runBuild(dockerCli command.Cli, in buildOptions) error {
if len(in.extraHosts) > 0 {
return errors.Errorf("extra hosts currently not implemented")
}
if in.squash {
return errors.Errorf("squash currently not implemented")
}
if in.quiet {
return errors.Errorf("quiet currently not implemented")
}
if in.networkMode != "default" {
return errors.Errorf("network currently not implemented")
}
if in.imageIDFile != "" {
return errors.Errorf("iidfile currently not implemented")
}
ctx := appcontext.Context()
@ -86,12 +77,15 @@ func runBuild(dockerCli command.Cli, in buildOptions) error {
DockerfilePath: in.dockerfileName,
InStream: os.Stdin,
},
Tags: in.tags,
Labels: listToMap(in.labels),
BuildArgs: listToMap(in.buildArgs),
Pull: in.pull,
NoCache: in.noCache,
Target: in.target,
Tags: in.tags,
Labels: listToMap(in.labels),
BuildArgs: listToMap(in.buildArgs),
Pull: in.pull,
NoCache: in.noCache,
Target: in.target,
ImageIDFile: in.imageIDFile,
ExtraHosts: in.extraHosts,
NetworkMode: in.networkMode,
}
platforms, err := build.ParsePlatformSpecs(in.platforms)
@ -170,9 +164,6 @@ func buildCmd(dockerCli command.Cli) *cobra.Command {
flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to the file")
flags.BoolVar(&options.squash, "squash", false, "Squash newly built layers into a single new layer")
flags.MarkHidden("quiet")
flags.MarkHidden("network")
flags.MarkHidden("add-host")
flags.MarkHidden("iidfile")
flags.MarkHidden("squash")
// hidden flags