feat(容器支持): 在linux环境下优先使用podman
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
xiaoqidun 2021-09-08 10:56:46 +08:00
parent 2389ae64d7
commit 292daa8a0c

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"os" "os"
"os/exec" "os/exec"
"runtime"
) )
var ( var (
@ -21,14 +22,21 @@ func main() {
Author() Author()
return return
} }
d := &DockerGoEnv{ binary := "docker"
if runtime.GOOS == "linux" {
podman, err := exec.LookPath("podman")
if err == nil {
binary = podman
}
}
docker := &DockerGoEnv{
Image: "xiaoqidun/goenv", Image: "xiaoqidun/goenv",
Binary: "docker", Binary: binary,
WorkDir: "/go/src/app", WorkDir: "/go/src/app",
AutoDelete: true, AutoDelete: true,
MountWorkDir: true, MountWorkDir: true,
} }
d.Run() docker.Run()
} }
func Author() { func Author() {