mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Hash the sums for directory (ureadable when there is too many
This commit is contained in:
parent
894d4a23fb
commit
cd735496da
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -418,9 +420,11 @@ func (b *buildFile) CmdAdd(args string) error {
|
|||
}
|
||||
}
|
||||
sort.Strings(subfiles)
|
||||
hash = strings.Join(subfiles, ",")
|
||||
hasher := sha256.New()
|
||||
hasher.Write([]byte(strings.Join(subfiles, ",")))
|
||||
hash = "dir:" + hex.EncodeToString(hasher.Sum(nil))
|
||||
} else {
|
||||
hash = sums[origPath]
|
||||
hash = "file:" + sums[origPath]
|
||||
}
|
||||
b.config.Cmd = []string{"/bin/sh", "-c", fmt.Sprintf("#(nop) ADD %s in %s", hash, dest)}
|
||||
hit, err := b.probeCache()
|
||||
|
|
Loading…
Reference in a new issue