mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-10 03:30:40 +00:00
Merge pull request #7 from antonikonovalov/master
fix(file): fixing work with Dockerfile.*
This commit is contained in:
commit
4a36ff8f96
12
main.go
12
main.go
@ -22,6 +22,8 @@ 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"`
|
||||||
|
// see more here https://docs.docker.com/reference/commandline/build/
|
||||||
|
Context string `json:"context"`
|
||||||
Dns []string `json:"dns"`
|
Dns []string `json:"dns"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,9 +48,13 @@ 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 {
|
if len(vargs.File) == 0 {
|
||||||
vargs.File = "."
|
vars.File = "Dockerfile"
|
||||||
|
}
|
||||||
|
// Set the Context value
|
||||||
|
if len(vargs.Context) == 0 {
|
||||||
|
vargs.Context = "."
|
||||||
}
|
}
|
||||||
// Set the Tag value
|
// Set the Tag value
|
||||||
if len(vargs.Tag) == 0 {
|
if len(vargs.Tag) == 0 {
|
||||||
@ -122,7 +128,7 @@ func main() {
|
|||||||
cmd.Run()
|
cmd.Run()
|
||||||
|
|
||||||
// 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("/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