Set OS/ARCH when assembling image
@@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "runtime"
"strconv"
"time"
@@ -565,6 +566,17 @@ func DoBuild(opts *config.KanikoOptions) (v1.Image, error) {
return nil, err
}
+ configFile, err := sourceImage.ConfigFile()
+ if err != nil {
+ return nil, err
+ }
+ configFile.OS = runtime.GOOS
+ configFile.Architecture = runtime.GOARCH
+ sourceImage, err = mutate.ConfigFile(sourceImage, configFile)
+ if err != nil {
+ return nil, err
+ }
+
d, err := sourceImage.Digest()
if err != nil {
return nil, err
