mirror of https://github.com/docker/cli.git
build: error out if buildkit is on and stdin is used for both dockerfile and context
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
5314a8fc06
commit
89e102474c
|
@ -35,6 +35,8 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var errStdinConflict = errors.New("invalid argument: can't use stdin for both build context and dockerfile")
|
||||||
|
|
||||||
type buildOptions struct {
|
type buildOptions struct {
|
||||||
context string
|
context string
|
||||||
dockerfileName string
|
dockerfileName string
|
||||||
|
@ -192,7 +194,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
|
||||||
|
|
||||||
if options.dockerfileFromStdin() {
|
if options.dockerfileFromStdin() {
|
||||||
if options.contextFromStdin() {
|
if options.contextFromStdin() {
|
||||||
return errors.New("invalid argument: can't use stdin for both build context and dockerfile")
|
return errStdinConflict
|
||||||
}
|
}
|
||||||
dockerfileCtx = dockerCli.In()
|
dockerfileCtx = dockerCli.In()
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,9 @@ func runBuildBuildKit(dockerCli command.Cli, options buildOptions) error {
|
||||||
)
|
)
|
||||||
switch {
|
switch {
|
||||||
case options.contextFromStdin():
|
case options.contextFromStdin():
|
||||||
|
if options.dockerfileFromStdin() {
|
||||||
|
return errStdinConflict
|
||||||
|
}
|
||||||
rc, isArchive, err := build.DetectArchiveReader(os.Stdin)
|
rc, isArchive, err := build.DetectArchiveReader(os.Stdin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue