diff --git a/builder/remotecontext/archive.go b/builder/remotecontext/archive.go index fc18c5da31..b62d9dd0b7 100644 --- a/builder/remotecontext/archive.go +++ b/builder/remotecontext/archive.go @@ -122,8 +122,5 @@ func normalize(path string, root containerfs.ContainerFS) (cleanPath, fullPath s if err != nil { return "", "", errors.Wrapf(err, "forbidden path outside the build context: %s (%s)", path, cleanPath) } - if _, err := root.Lstat(fullPath); err != nil { - return "", "", errors.WithStack(convertPathError(err, path)) - } return } diff --git a/builder/remotecontext/lazycontext.go b/builder/remotecontext/lazycontext.go index 66f36defd4..14848baa13 100644 --- a/builder/remotecontext/lazycontext.go +++ b/builder/remotecontext/lazycontext.go @@ -40,16 +40,16 @@ func (c *lazySource) Hash(path string) (string, error) { return "", err } - fi, err := c.root.Lstat(fullPath) - if err != nil { - return "", errors.WithStack(err) - } - relPath, err := Rel(c.root, fullPath) if err != nil { return "", errors.WithStack(convertPathError(err, cleanPath)) } + fi, err := os.Lstat(fullPath) + if err != nil { + return relPath, nil + } + sum, ok := c.sums[relPath] if !ok { sum, err = c.prepareHash(relPath, fi)