Merge pull request #1130 from Vlatombe/set_image_platform

Set image platform for any build
This commit is contained in:
Tejal Desai 2020-03-25 10:10:41 -07:00 committed by GitHub
commit 1978f1e08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"time"
@ -589,6 +590,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