mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-06-22 10:10:52 +02:00
add binfmt switch
This commit is contained in:
parent
52b4cc2805
commit
9ba08fde5b
|
@ -99,6 +99,12 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
|
||||||
EnvVars: []string{"PLUGIN_BUILDKIT_CONFIG"},
|
EnvVars: []string{"PLUGIN_BUILDKIT_CONFIG"},
|
||||||
Destination: &settings.Daemon.BuildkitConfig,
|
Destination: &settings.Daemon.BuildkitConfig,
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "daemon.install-binfmt",
|
||||||
|
Usage: "run bimfmt binaries installer",
|
||||||
|
EnvVars: []string{"PLUGIN_INSTALL_BINFMT"},
|
||||||
|
Destination: &settings.Daemon.InstallBinfmt,
|
||||||
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "dockerfile",
|
Name: "dockerfile",
|
||||||
Usage: "build dockerfile",
|
Usage: "build dockerfile",
|
||||||
|
|
|
@ -52,6 +52,14 @@ func commandInfo() *exec.Cmd {
|
||||||
return exec.Command(dockerExe, "info")
|
return exec.Command(dockerExe, "info")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func commandInstallBinfmt() *exec.Cmd {
|
||||||
|
return exec.Command(
|
||||||
|
dockerExe, "run",
|
||||||
|
"--privileged", "--rm",
|
||||||
|
"tonistiigi/binfmt", "--install all"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
func commandBuilder(daemon Daemon) *exec.Cmd {
|
func commandBuilder(daemon Daemon) *exec.Cmd {
|
||||||
args := []string{
|
args := []string{
|
||||||
"buildx",
|
"buildx",
|
||||||
|
|
|
@ -27,6 +27,7 @@ type Daemon struct {
|
||||||
IPv6 bool // Docker daemon IPv6 networking
|
IPv6 bool // Docker daemon IPv6 networking
|
||||||
Experimental bool // Docker daemon enable experimental mode
|
Experimental bool // Docker daemon enable experimental mode
|
||||||
BuildkitConfig string // Docker buildkit config
|
BuildkitConfig string // Docker buildkit config
|
||||||
|
InstallBinfmt bool // Install binfmt binaries for better emulation support
|
||||||
}
|
}
|
||||||
|
|
||||||
// Login defines Docker login parameters.
|
// Login defines Docker login parameters.
|
||||||
|
@ -160,6 +161,11 @@ func (p *Plugin) Execute() error {
|
||||||
p.settings.Build.Squash = false
|
p.settings.Build.Squash = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// run the binfmt docker image if requested
|
||||||
|
if p.settings.Daemon.InstallBinfmt {
|
||||||
|
commandInstallBinfmt()
|
||||||
|
}
|
||||||
|
|
||||||
// add proxy build args
|
// add proxy build args
|
||||||
addProxyBuildArgs(&p.settings.Build)
|
addProxyBuildArgs(&p.settings.Build)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user