BuildArgsMap converts a slice of "KEY=VALUE" strings to a map.
(buildArgs []string)
| 308 | |
| 309 | // BuildArgsMap converts a slice of "KEY=VALUE" strings to a map. |
| 310 | func BuildArgsMap(buildArgs []string) map[string]string { |
| 311 | m := make(map[string]string, len(buildArgs)) |
| 312 | for _, arg := range buildArgs { |
| 313 | if key, val, ok := strings.Cut(arg, "="); ok { |
| 314 | m[key] = val |
| 315 | } |
| 316 | } |
| 317 | return m |
| 318 | } |
| 319 | |
| 320 | // UserFromDockerfile inspects the contents of a provided Dockerfile |
| 321 | // and returns the user that will be used to run the container. |