MCPcopy
hub / github.com/docker/compose / resolveAndMergeBuildArgs

Function resolveAndMergeBuildArgs

pkg/compose/build.go:252–267  ·  view source on GitHub ↗

resolveAndMergeBuildArgs returns the final set of build arguments to use for the service image build. First, args directly defined via `build.args` in YAML are considered. Then, any explicitly passed args in opts (e.g. via `--build-arg` on the CLI) are merged, overwriting any keys that already exis

(proxyConfig map[string]string, project *types.Project, service types.ServiceConfig, opts api.BuildOptions)

Source from the content-addressed store, hash-verified

250// Finally, standard proxy variables based on the Docker client configuration are added, but will not overwrite
251// any values if already present.
252func resolveAndMergeBuildArgs(proxyConfig map[string]string, project *types.Project, service types.ServiceConfig, opts api.BuildOptions) types.MappingWithEquals {
253 result := make(types.MappingWithEquals).
254 OverrideBy(service.Build.Args).
255 OverrideBy(opts.Args).
256 Resolve(envResolver(project.Environment))
257
258 // proxy arguments do NOT override and should NOT have env resolution applied,
259 // so they're handled last
260 for k, v := range proxyConfig {
261 if _, ok := result[k]; !ok {
262 v := v
263 result[k] = &v
264 }
265 }
266 return result
267}
268
269func getImageBuildLabels(project *types.Project, service types.ServiceConfig) types.Labels {
270 ret := make(types.Labels)

Callers 2

doBuildBakeMethod · 0.85
imageBuildOptionsFunction · 0.85

Calls 1

envResolverFunction · 0.85

Tested by

no test coverage detected