mirror of https://github.com/docker/docs.git
Fix ADD behavior on single files
This commit is contained in:
parent
881fdc59ed
commit
faafbf2118
10
buildfile.go
10
buildfile.go
|
@ -213,13 +213,17 @@ func (b *buildFile) CmdAdd(args string) error {
|
||||||
if container == nil {
|
if container == nil {
|
||||||
return fmt.Errorf("Error while creating the container (CmdAdd)")
|
return fmt.Errorf("Error while creating the container (CmdAdd)")
|
||||||
}
|
}
|
||||||
|
if err := container.EnsureMounted(); err != nil {
|
||||||
if err := os.MkdirAll(path.Join(container.rwPath(), dest), 0700); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer container.Unmount()
|
||||||
|
|
||||||
origPath := path.Join(b.context, orig)
|
origPath := path.Join(b.context, orig)
|
||||||
destPath := path.Join(container.rwPath(), dest)
|
destPath := path.Join(container.RootfsPath(), dest)
|
||||||
|
|
||||||
|
if err := os.MkdirAll(path.Dir(destPath), 0700); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
fi, err := os.Stat(origPath)
|
fi, err := os.Stat(origPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue