Add add-hosts to DockerBuild
Signed-off-by: dubo-dubon-duponey <dubodubonduponey+github@pm.me>
This commit is contained in:
parent
38200f556c
commit
53611be733
@ -849,6 +849,25 @@ func dockerBuildOpts(op *compiler.Value) (map[string]string, error) {
|
|||||||
}
|
}
|
||||||
opts["target"] = tgr
|
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 {
|
||||||
|
@ -93,6 +93,7 @@ package op
|
|||||||
buildArg?: [string]: string
|
buildArg?: [string]: string
|
||||||
label?: [string]: string
|
label?: [string]: string
|
||||||
target?: string
|
target?: string
|
||||||
|
hosts?: [string]: string
|
||||||
}
|
}
|
||||||
|
|
||||||
#WriteFile: {
|
#WriteFile: {
|
||||||
|
Reference in New Issue
Block a user