mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-22 20:20:39 +00:00
refact(main): readable
This commit is contained in:
parent
9794f92866
commit
0f4ab18017
14
main.go
14
main.go
@ -48,7 +48,11 @@ func main() {
|
|||||||
if len(vargs.Registry) == 0 {
|
if len(vargs.Registry) == 0 {
|
||||||
vargs.Registry = "https://index.docker.io/v1/"
|
vargs.Registry = "https://index.docker.io/v1/"
|
||||||
}
|
}
|
||||||
// Set the Dockerfile path
|
// Set the Dockerfile name
|
||||||
|
if len(vargs.File) == 0 {
|
||||||
|
vars.File = "Dockerfile"
|
||||||
|
}
|
||||||
|
// Set the Context value
|
||||||
if len(vargs.Context) == 0 {
|
if len(vargs.Context) == 0 {
|
||||||
vargs.Context = "."
|
vargs.Context = "."
|
||||||
}
|
}
|
||||||
@ -123,14 +127,8 @@ func main() {
|
|||||||
trace(cmd)
|
trace(cmd)
|
||||||
cmd.Run()
|
cmd.Run()
|
||||||
|
|
||||||
strCmd := []string{"/usr/bin/docker", "build", "--pull=true","--rm=true", "-t", vargs.Repo, vargs.Context}
|
|
||||||
// Add file flag to cmd
|
|
||||||
if len(vargs.File) != 0 {
|
|
||||||
strCmd = append(append(strCmd[0:3],"-f="+vargs.File),strCmd[4:]...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build the container
|
// Build the container
|
||||||
cmd = exec.Command(strCmd[0],strCmd[1:]...)
|
cmd = exec.Command("/usr/bin/docker", "build", "--pull=true", "--rm=true", "-f", vars.File, "-t", vargs.Repo, vargs.Context)
|
||||||
cmd.Dir = workspace.Path
|
cmd.Dir = workspace.Path
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
Loading…
Reference in New Issue
Block a user