llb: don't fill platform on static sources

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-07-16 10:05:41 -07:00
parent 98f1604134
commit 1456a3f165
1 changed files with 9 additions and 0 deletions

View File

@ -65,6 +65,11 @@ func (s *SourceOp) Marshal(constraints *Constraints) (digest.Digest, []byte, *pb
proto.Op = &pb.Op_Source{
Source: &pb.SourceOp{Identifier: s.id, Attrs: s.attrs},
}
if !platformSpecificSource(s.id) {
proto.Platform = nil
}
dt, err := proto.Marshal()
if err != nil {
return "", nil, nil, err
@ -361,3 +366,7 @@ func Chown(uid, gid int) HTTPOption {
hi.GID = gid
})
}
func platformSpecificSource(id string) bool {
return strings.HasPrefix(id, "docker-image://")
}