|
|
|
@ -426,6 +426,7 @@ type Target struct {
|
|
|
|
|
Outputs []string `json:"output,omitempty" hcl:"output,optional"`
|
|
|
|
|
Pull *bool `json:"pull,omitempty" hcl:"pull,optional"`
|
|
|
|
|
NoCache *bool `json:"no-cache,omitempty" hcl:"no-cache,optional"`
|
|
|
|
|
NetworkMode *string `json:"network,omitempty" hcl:"network,optional"`
|
|
|
|
|
|
|
|
|
|
// IMPORTANT: if you add more fields here, do not forget to update newOverrides and README.
|
|
|
|
|
}
|
|
|
|
@ -492,6 +493,9 @@ func (t *Target) Merge(t2 *Target) {
|
|
|
|
|
if t2.NoCache != nil {
|
|
|
|
|
t.NoCache = t2.NoCache
|
|
|
|
|
}
|
|
|
|
|
if t2.NetworkMode != nil {
|
|
|
|
|
t.NetworkMode = t2.NetworkMode
|
|
|
|
|
}
|
|
|
|
|
t.Inherits = append(t.Inherits, t2.Inherits...)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -563,6 +567,8 @@ func (t *Target) AddOverrides(overrides map[string]Override) error {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case "network":
|
|
|
|
|
t.NetworkMode = &o.Value
|
|
|
|
|
default:
|
|
|
|
|
return errors.Errorf("unknown key: %s", keys[0])
|
|
|
|
|
}
|
|
|
|
@ -632,6 +638,10 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
|
|
|
|
|
if t.Pull != nil {
|
|
|
|
|
pull = *t.Pull
|
|
|
|
|
}
|
|
|
|
|
networkMode := ""
|
|
|
|
|
if t.NetworkMode != nil {
|
|
|
|
|
networkMode = *t.NetworkMode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bi := build.Inputs{
|
|
|
|
|
ContextPath: contextPath,
|
|
|
|
@ -654,6 +664,7 @@ func toBuildOpt(t *Target, inp *Input) (*build.Options, error) {
|
|
|
|
|
Labels: t.Labels,
|
|
|
|
|
NoCache: noCache,
|
|
|
|
|
Pull: pull,
|
|
|
|
|
NetworkMode: networkMode,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
platforms, err := platformutil.Parse(t.Platforms)
|
|
|
|
|