From 9fcc475d033d7f1718e9490e8944de7f31a2bbab Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 15 May 2018 17:29:09 -0400 Subject: Support pulling Dockerfile from http Currently podman build http://remote.com/Dockerfile does not work. podman always treats this file as an Archive. Vendoring in the latest buildah code fixes this issue. Also updated the man pages to better explain the syntax. Signed-off-by: Daniel J Walsh Closes: #775 Approved by: TomSweeneyRedHat --- .../projectatomic/buildah/imagebuildah/util.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'vendor/github.com/projectatomic/buildah/imagebuildah') diff --git a/vendor/github.com/projectatomic/buildah/imagebuildah/util.go b/vendor/github.com/projectatomic/buildah/imagebuildah/util.go index 805cfce44..b437ea1cb 100644 --- a/vendor/github.com/projectatomic/buildah/imagebuildah/util.go +++ b/vendor/github.com/projectatomic/buildah/imagebuildah/util.go @@ -7,6 +7,7 @@ import ( "os" "os/exec" "path" + "path/filepath" "strings" "github.com/containers/storage/pkg/chrootarchive" @@ -34,7 +35,23 @@ func downloadToDirectory(url, dir string) error { if resp.ContentLength == 0 { return errors.Errorf("no contents in %q", url) } - return chrootarchive.Untar(resp.Body, dir, nil) + if err := chrootarchive.Untar(resp.Body, dir, nil); err != nil { + resp1, err := http.Get(url) + if err != nil { + return errors.Wrapf(err, "error getting %q", url) + } + defer resp1.Body.Close() + body, err := ioutil.ReadAll(resp1.Body) + if err != nil { + return errors.Wrapf(err, "Failed to read %q", url) + } + dockerfile := filepath.Join(dir, "Dockerfile") + // Assume this is a Dockerfile + if err := ioutil.WriteFile(dockerfile, body, 0600); err != nil { + return errors.Wrapf(err, "Failed to write %q to %q", url, dockerfile) + } + } + return nil } // TempDirForURL checks if the passed-in string looks like a URL. If it is, -- cgit v1.2.3-54-g00ecf