mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-25 04:38:03 +08:00
@@ -37,6 +37,7 @@ type Options struct {
|
||||
Pull bool
|
||||
ImageIDFile string
|
||||
ExtraHosts []string
|
||||
NetworkMode string
|
||||
|
||||
NoCache bool
|
||||
Target string
|
||||
@@ -228,6 +229,14 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, pw
|
||||
so.FrontendAttrs["platform"] = strings.Join(pp, ",")
|
||||
}
|
||||
|
||||
switch opt.NetworkMode {
|
||||
case "host", "none":
|
||||
so.FrontendAttrs["force-network-mode"] = opt.NetworkMode
|
||||
case "", "default":
|
||||
default:
|
||||
return nil, errors.Errorf("network mode %q not supported by buildkit", opt.NetworkMode)
|
||||
}
|
||||
|
||||
extraHosts, err := toBuildkitExtraHosts(opt.ExtraHosts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user