github.com/akerouanton/docker@v1.11.0-rc3/builder/git.go (about) 1 package builder 2 3 import ( 4 "os" 5 6 "github.com/docker/docker/pkg/archive" 7 "github.com/docker/docker/pkg/gitutils" 8 ) 9 10 // MakeGitContext returns a Context from gitURL that is cloned in a temporary directory. 11 func MakeGitContext(gitURL string) (ModifiableContext, error) { 12 root, err := gitutils.Clone(gitURL) 13 if err != nil { 14 return nil, err 15 } 16 17 c, err := archive.Tar(root, archive.Uncompressed) 18 if err != nil { 19 return nil, err 20 } 21 22 defer func() { 23 // TODO: print errors? 24 c.Close() 25 os.RemoveAll(root) 26 }() 27 return MakeTarSumContext(c) 28 }