diff --git a/_docs/data/data.yaml b/_docs/data/data.yaml index c9f762b..2791fe5 100644 --- a/_docs/data/data.yaml +++ b/_docs/data/data.yaml @@ -90,6 +90,14 @@ properties: defaultValue: false required: false + - name: max_concurrent_uploads + description: | + By default the Docker daemon will push five layers of an image at a time. If you are on a low bandwidth connection this may cause + timeout issues and you may want to lower with this option. + type: string + defaultValue: 5 + required: false + - name: containerfile description: Set the containerfile to use for the image build. defaultValue: Containerfile diff --git a/cmd/wp-docker-buildx/config.go b/cmd/wp-docker-buildx/config.go index dd297b6..2367352 100644 --- a/cmd/wp-docker-buildx/config.go +++ b/cmd/wp-docker-buildx/config.go @@ -115,11 +115,18 @@ func settingsFlags(settings *plugin.Settings, category string) []cli.Flag { Destination: &settings.Daemon.BuildkitConfig, Category: category, }, + &cli.StringFlag{ + Name: "daemon.max-concurrent-uploads", + EnvVars: []string{"PLUGIN_MAX_CONCURRENT_UPLOADS"}, + Usage: "max concurrent uploads for each push", + Destination: &settings.Daemon.MaxConcurrentUploads, + Category: category, + }, &cli.StringFlag{ Name: "containerfile", EnvVars: []string{"PLUGIN_CONTAINERFILE"}, - Usage: "containerfile to use for the image build", - Value: "Containerfile", + Usage: "max concurrent uploads", + Value: "5", Destination: &settings.Build.Containerfile, Category: category, }, diff --git a/plugin/docker.go b/plugin/docker.go index 9eb0459..9b4e086 100644 --- a/plugin/docker.go +++ b/plugin/docker.go @@ -214,6 +214,7 @@ func hasProxyBuildArg(build *Build, key string) bool { func commandDaemon(daemon Daemon) *execabs.Cmd { args := []string{ "--data-root", daemon.StoragePath, + "--max-concurrent-uploads", daemon.MaxConcurrentUploads, "--host=unix:///var/run/docker.sock", } @@ -229,11 +230,11 @@ func commandDaemon(daemon Daemon) *execabs.Cmd { args = append(args, "--ipv6") } - if len(daemon.Mirror) != 0 { + if daemon.Mirror != "" { args = append(args, "--registry-mirror", daemon.Mirror) } - if len(daemon.Bip) != 0 { + if daemon.Bip != "" { args = append(args, "--bip", daemon.Bip) } @@ -245,7 +246,7 @@ func commandDaemon(daemon Daemon) *execabs.Cmd { args = append(args, "--dns-search", dnsSearch) } - if len(daemon.MTU) != 0 { + if daemon.MTU != "" { args = append(args, "--mtu", daemon.MTU) } diff --git a/plugin/plugin.go b/plugin/plugin.go index be5e0d4..9fd71ac 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -21,20 +21,21 @@ type Settings struct { // Daemon defines Docker daemon parameters. type Daemon struct { - Registry string // Docker registry - Mirror string // Docker registry mirror - Insecure bool // Docker daemon enable insecure registries - StorageDriver string // Docker daemon storage driver - StoragePath string // Docker daemon storage path - Disabled bool // DOcker daemon is disabled (already running) - Debug bool // Docker daemon started in debug mode - Bip string // Docker daemon network bridge IP address - DNS cli.StringSlice // Docker daemon dns server - DNSSearch cli.StringSlice // Docker daemon dns search domain - MTU string // Docker daemon mtu setting - IPv6 bool // Docker daemon IPv6 networking - Experimental bool // Docker daemon enable experimental mode - BuildkitConfig string // Docker buildkit config + Registry string // Docker registry + Mirror string // Docker registry mirror + Insecure bool // Docker daemon enable insecure registries + StorageDriver string // Docker daemon storage driver + StoragePath string // Docker daemon storage path + Disabled bool // DOcker daemon is disabled (already running) + Debug bool // Docker daemon started in debug mode + Bip string // Docker daemon network bridge IP address + DNS cli.StringSlice // Docker daemon dns server + DNSSearch cli.StringSlice // Docker daemon dns search domain + MTU string // Docker daemon mtu setting + IPv6 bool // Docker daemon IPv6 networking + Experimental bool // Docker daemon enable experimental mode + BuildkitConfig string // Docker buildkit config + MaxConcurrentUploads string } // Login defines Docker login parameters.