mirror of
https://github.com/xiaoqidun/goenv.git
synced 2024-11-23 00:26:45 +08:00
feat(容器支持): 在linux环境下优先使用podman
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2389ae64d7
commit
292daa8a0c
14
goenv.go
14
goenv.go
@ -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() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user