Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hinshun committed Apr 9, 2021
1 parent 384e898 commit 2eba3f3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions codegen/builtin_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ func (m Copy) Call(ctx context.Context, cln *client.Client, ret Register, opts O
)
fs.SolveOpts = append(fs.SolveOpts, input.SolveOpts...)
fs.SessionOpts = append(fs.SessionOpts, input.SessionOpts...)
commitHistory(fs.Image, false, "COPY %s %s", src, dest)

return ret.Set(fs)
}
Expand Down Expand Up @@ -518,6 +519,10 @@ func (l Label) Call(ctx context.Context, cln *client.Client, ret Register, opts

fs.Image.Config.Labels[key] = value

// In Dockerfile, multiple labels can be specified in the same LABEL command
// leading to one history element. This checks if the previous history
// committed was also a label, in which case it should just add to the
// previous history element.
numHistory := len(fs.Image.History)
if numHistory > 0 && strings.HasPrefix(fs.Image.History[numHistory-1].CreatedBy, "LABEL") {
fs.Image.History[numHistory-1].CreatedBy = fmt.Sprintf("%s %s=%s", fs.Image.History[numHistory-1].CreatedBy, key, value)
Expand Down

0 comments on commit 2eba3f3

Please sign in to comment.