woodpecker-docker-buildx/plugin/daemon.go
Lauris BH 8a0424c7a5 Automatically generate buildkit config with registry CA file (#17)
Fixes #14

Buildkit config is actually TOML file not JSON - https://docs.docker.com/engine/reference/commandline/buildx_create/#config

Tested using `lafriks/plugin-docker-buildx:latest` image built with these changes

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/17
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
2022-09-27 22:33:05 +02:00

30 lines
568 B
Go

package plugin
import (
"io"
"os"
)
const (
dockerExe = "/usr/local/bin/docker"
dockerdExe = "/usr/local/bin/dockerd"
dockerHome = "/root/.docker/"
buildkitConfig = "/tmp/buildkit.toml"
buildkitConfigTemplate = "[registry.\"%s\"]\n ca=[\"%s\"]\n"
)
func (p Plugin) startDaemon() {
cmd := commandDaemon(p.settings.Daemon)
if p.settings.Daemon.Debug {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
} else {
cmd.Stdout = io.Discard
cmd.Stderr = io.Discard
}
go func() {
trace(cmd)
cmd.Run()
}()
}