diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-05-15 17:29:09 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-05-16 14:39:55 +0000 |
commit | 9fcc475d033d7f1718e9490e8944de7f31a2bbab (patch) | |
tree | ee2c2c93392a188b4392ab64649b929d1e60f027 /vendor/github.com/projectatomic/buildah/imagebuildah/util.go | |
parent | 1aaf8df5be32d755a3f72f9259c66c70fbf850d8 (diff) | |
download | podman-9fcc475d033d7f1718e9490e8944de7f31a2bbab.tar.gz podman-9fcc475d033d7f1718e9490e8944de7f31a2bbab.tar.bz2 podman-9fcc475d033d7f1718e9490e8944de7f31a2bbab.zip |
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 <dwalsh@redhat.com>
Closes: #775
Approved by: TomSweeneyRedHat
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/imagebuildah/util.go')
-rw-r--r-- | vendor/github.com/projectatomic/buildah/imagebuildah/util.go | 19 |
1 files changed, 18 insertions, 1 deletions
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, |