Merge pull request #17710 from tonistiigi/fix-builder-symlinks
Fix symlink handling in builder ADD/COPY commands Upstream-commit: bf5a6d2a83cafd6f56224cdabd8692890472950a Component: engine
This commit is contained in:
@ -1251,6 +1251,14 @@ func buildImage(name, dockerfile string, useCache bool, buildFlags ...string) (s
|
||||
}
|
||||
|
||||
func buildImageFromContext(name string, ctx *FakeContext, useCache bool, buildFlags ...string) (string, error) {
|
||||
id, _, err := buildImageFromContextWithOut(name, ctx, useCache, buildFlags...)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func buildImageFromContextWithOut(name string, ctx *FakeContext, useCache bool, buildFlags ...string) (string, string, error) {
|
||||
args := []string{"build", "-t", name}
|
||||
if !useCache {
|
||||
args = append(args, "--no-cache")
|
||||
@ -1261,9 +1269,13 @@ func buildImageFromContext(name string, ctx *FakeContext, useCache bool, buildFl
|
||||
buildCmd.Dir = ctx.Dir
|
||||
out, exitCode, err := runCommandWithOutput(buildCmd)
|
||||
if err != nil || exitCode != 0 {
|
||||
return "", fmt.Errorf("failed to build the image: %s", out)
|
||||
return "", "", fmt.Errorf("failed to build the image: %s", out)
|
||||
}
|
||||
return getIDByName(name)
|
||||
id, err := getIDByName(name)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
return id, out, nil
|
||||
}
|
||||
|
||||
func buildImageFromPath(name, path string, useCache bool, buildFlags ...string) (string, error) {
|
||||
|
||||
Reference in New Issue
Block a user