Merge pull request #438 from dubo-dubon-duponey/build
Support for target & hosts (#DockerBuild)
This commit is contained in:
commit
9f5dfacbbf
@ -842,6 +842,32 @@ func dockerBuildOpts(op *compiler.Value) (map[string]string, error) {
|
|||||||
opts["filename"] = filename
|
opts["filename"] = filename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if target := op.Lookup("target"); target.Exists() {
|
||||||
|
tgr, err := target.String()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
opts["target"] = tgr
|
||||||
|
}
|
||||||
|
|
||||||
|
if hosts := op.Lookup("hosts"); hosts.Exists() {
|
||||||
|
p := []string{}
|
||||||
|
fields, err := hosts.Fields()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, host := range fields {
|
||||||
|
s, err := host.Value.String()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
p = append(p, host.Label()+"="+s)
|
||||||
|
}
|
||||||
|
if len(p) > 0 {
|
||||||
|
opts["add-hosts"] = strings.Join(p, ",")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if buildArgs := op.Lookup("buildArg"); buildArgs.Exists() {
|
if buildArgs := op.Lookup("buildArg"); buildArgs.Exists() {
|
||||||
fields, err := buildArgs.Fields()
|
fields, err := buildArgs.Fields()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -92,6 +92,8 @@ package op
|
|||||||
platforms?: [...string]
|
platforms?: [...string]
|
||||||
buildArg?: [string]: string
|
buildArg?: [string]: string
|
||||||
label?: [string]: string
|
label?: [string]: string
|
||||||
|
target?: string
|
||||||
|
hosts?: [string]: string
|
||||||
}
|
}
|
||||||
|
|
||||||
#WriteFile: {
|
#WriteFile: {
|
||||||
|
Reference in New Issue
Block a user