mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Docker Build: Use tonistiigi/binfmt image for cross compilation (#64108)
* Change docker image used for cross-compilation * Replace fmt.Println with log.Println * Add specific tag for docker image
This commit is contained in:
committed by
GitHub
parent
b731540939
commit
b42fd92fad
@@ -10,6 +10,9 @@ import (
|
||||
// AllArchs is a list of all supported Docker image architectures.
|
||||
var AllArchs = []string{"amd64", "armv7", "arm64"}
|
||||
|
||||
// emulatorImage is the docker image used as the cross-platform emulator
|
||||
var emulatorImage = "tonistiigi/binfmt:qemu-v7.0.0"
|
||||
|
||||
// Init initializes the OS for Docker image building.
|
||||
func Init() error {
|
||||
// Necessary for cross-platform builds
|
||||
@@ -18,11 +21,14 @@ func Init() error {
|
||||
}
|
||||
|
||||
// Enable execution of Docker images for other architectures
|
||||
//nolint:gosec
|
||||
cmd := exec.Command("docker", "run", "--privileged", "--rm",
|
||||
"docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64")
|
||||
emulatorImage, "--install", "all")
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to enable execution of cross-platform Docker images: %w\n%s", err, output)
|
||||
}
|
||||
log.Println("emulators have been installed successfully!")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user