Set OS/ARCH when assembling image

This commit is contained in:
Vincent Latombe 2020-03-12 10:41:32 +01:00
parent c718dc61a6
commit 4d26c1f51e
No known key found for this signature in database
GPG Key ID: B530C2054A24D927
1 changed files with 12 additions and 0 deletions

View File

@ -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