fix: do not set network flag when building dockerfile images

The network flag is unsupported by the docker image build command under buildx (which is default now).

Closes #7520
This commit is contained in:
Jose Diaz-Gonzalez committed 2025-03-09 06:56:56 -04:00
1 parent ed58641d41
commit 87cbbdbc9a
2 files changed
+12 -4

No files matched your search

+6 -3
View File
@@ -20,13 +20,16 @@ func main() {
switch trigger { switch trigger {
case "docker-args-process-build": case "docker-args-process-build":
appName := flag.Arg(0) appName := flag.Arg(0)
err = network.TriggerDockerArgsProcess(appName) imageSourceType := flag.Arg(1)
err = network.TriggerDockerArgsProcess("build", appName, imageSourceType)
case "docker-args-process-deploy": case "docker-args-process-deploy":
appName := flag.Arg(0) appName := flag.Arg(0)
err = network.TriggerDockerArgsProcess(appName) imageSourceType := flag.Arg(1)
err = network.TriggerDockerArgsProcess("deploy", appName, imageSourceType)
case "docker-args-process-run": case "docker-args-process-run":
appName := flag.Arg(0) appName := flag.Arg(0)
err = network.TriggerDockerArgsProcess(appName) imageSourceType := flag.Arg(1)
err = network.TriggerDockerArgsProcess("run", appName, imageSourceType)
case "install": case "install":
err = network.TriggerInstall() err = network.TriggerInstall()
case "network-build-config": case "network-build-config":
+6 -1
View File
@@ -10,12 +10,17 @@ import (
) )
// TriggerDockerArgsProcess outputs the network plugin docker options for an app // TriggerDockerArgsProcess outputs the network plugin docker options for an app
func TriggerDockerArgsProcess(appName string) error { func TriggerDockerArgsProcess(stage string, appName string, imageSourceType string) error {
stdin, err := io.ReadAll(os.Stdin) stdin, err := io.ReadAll(os.Stdin)
if err != nil { if err != nil {
return err return err
} }
if stage == "build" && imageSourceType == "dockerfile" {
fmt.Print(string(stdin))
return nil
}
initialNetwork := reportComputedInitialNetwork(appName) initialNetwork := reportComputedInitialNetwork(appName)
if initialNetwork != "" { if initialNetwork != "" {
fmt.Printf(" --network=%s ", initialNetwork) fmt.Printf(" --network=%s ", initialNetwork)