2021-01-11 20:54:49 +00:00
|
|
|
package plugin
|
2019-08-14 19:51:43 +00:00
|
|
|
|
|
|
|
import (
|
2021-07-25 12:28:33 +00:00
|
|
|
"io"
|
2019-08-14 19:51:43 +00:00
|
|
|
"os"
|
2024-01-03 20:23:07 +00:00
|
|
|
|
|
|
|
"github.com/thegeeklab/wp-plugin-go/trace"
|
2019-08-14 19:51:43 +00:00
|
|
|
)
|
|
|
|
|
2022-04-25 10:51:42 +00:00
|
|
|
const (
|
2023-02-08 09:13:28 +00:00
|
|
|
dockerBin = "/usr/local/bin/docker"
|
|
|
|
dockerdBin = "/usr/local/bin/dockerd"
|
2022-04-25 10:51:42 +00:00
|
|
|
dockerHome = "/root/.docker/"
|
2023-01-08 13:41:49 +00:00
|
|
|
buildkitConfig = "/tmp/buildkit.toml"
|
2022-04-25 10:51:42 +00:00
|
|
|
)
|
2019-08-14 19:51:43 +00:00
|
|
|
|
|
|
|
func (p Plugin) startDaemon() {
|
2023-08-13 20:08:53 +00:00
|
|
|
cmd := commandDaemon(p.Settings.Daemon)
|
|
|
|
if p.Settings.Daemon.Debug {
|
2019-08-14 19:51:43 +00:00
|
|
|
cmd.Stdout = os.Stdout
|
|
|
|
cmd.Stderr = os.Stderr
|
|
|
|
} else {
|
2021-07-25 12:28:33 +00:00
|
|
|
cmd.Stdout = io.Discard
|
|
|
|
cmd.Stderr = io.Discard
|
2019-08-14 19:51:43 +00:00
|
|
|
}
|
2023-02-08 09:13:28 +00:00
|
|
|
|
2019-08-14 19:51:43 +00:00
|
|
|
go func() {
|
2024-01-03 20:23:07 +00:00
|
|
|
trace.Cmd(cmd)
|
2022-04-25 10:51:42 +00:00
|
|
|
_ = cmd.Run()
|
2019-08-14 19:51:43 +00:00
|
|
|
}()
|
2020-03-24 20:49:10 +00:00
|
|
|
}
|