local: fix when include is not specified

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-02-17 17:19:49 -08:00
parent 845fe7eca4
commit 3ddd967291

View File

@ -223,9 +223,12 @@ func (p *Pipeline) Local(ctx context.Context, op *compiler.Value) error {
return err return err
} }
var include []string var include []string
if err := op.Get("include").Decode(&include); err != nil { if inc := op.Get("include"); inc.Exists() {
if err := inc.Decode(&include); err != nil {
return err return err
} }
}
p.fs = p.fs.Change(func(st llb.State) llb.State { p.fs = p.fs.Change(func(st llb.State) llb.State {
return st.File(llb.Copy( return st.File(llb.Copy(
llb.Local(dir, llb.FollowPaths(include)), llb.Local(dir, llb.FollowPaths(include)),