mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-13 22:50:41 +00:00
fix(file): fixing work with Dockerfile.*
now it's not work becaouse file != context see more here https://docs.docker.com/reference/commandline/build/
This commit is contained in:
parent
f0a3522ded
commit
9794f92866
16
main.go
16
main.go
@ -22,7 +22,9 @@ type Docker struct {
|
|||||||
Repo string `json:"repo"`
|
Repo string `json:"repo"`
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Dns []string `json:"dns"`
|
// see more here https://docs.docker.com/reference/commandline/build/
|
||||||
|
Context string `json:"context"`
|
||||||
|
Dns []string `json:"dns"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -47,8 +49,8 @@ func main() {
|
|||||||
vargs.Registry = "https://index.docker.io/v1/"
|
vargs.Registry = "https://index.docker.io/v1/"
|
||||||
}
|
}
|
||||||
// Set the Dockerfile path
|
// Set the Dockerfile path
|
||||||
if len(vargs.File) == 0 {
|
if len(vargs.Context) == 0 {
|
||||||
vargs.File = "."
|
vargs.Context = "."
|
||||||
}
|
}
|
||||||
// Set the Tag value
|
// Set the Tag value
|
||||||
if len(vargs.Tag) == 0 {
|
if len(vargs.Tag) == 0 {
|
||||||
@ -121,8 +123,14 @@ 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("/usr/bin/docker", "build", "--pull=true", "--rm=true", "-t", vargs.Repo, vargs.File)
|
cmd = exec.Command(strCmd[0],strCmd[1:]...)
|
||||||
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