Skip to content

Commit

Permalink
re moby#2112 specify dockerfile to build
Browse files Browse the repository at this point in the history
  • Loading branch information
vagrant committed Oct 17, 2013
1 parent 47cc6c8 commit 801acaa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions commands.go
Expand Up @@ -170,6 +170,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
tag := cmd.String("t", "", "Repository name (and optionally a tag) to be applied to the resulting image in case of success")
suppressOutput := cmd.Bool("q", false, "Suppress verbose build output")
noCache := cmd.Bool("no-cache", false, "Do not use cache when building the image")
dockerfile := cmd.String("f", "", "Dockerfile to use - defaults to ./Dockerfile")
rm := cmd.Bool("rm", false, "Remove intermediate containers after a successful build")
if err := cmd.Parse(args); err != nil {
return nil
Expand All @@ -193,6 +194,13 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
return err
}
context, err = mkBuildContext(string(dockerfile), nil)
} else if len(dockerfile) > 0 {
dockerfilecontent, err := os.Open(dockerfile)
if err != nil {
return err
}
context, err = mkBuildContext(string(dockerfilecontent), nil)

} else if utils.IsURL(cmd.Arg(0)) || utils.IsGIT(cmd.Arg(0)) {
isRemote = true
} else {
Expand Down

0 comments on commit 801acaa

Please sign in to comment.