0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-09-19 15:12:44 +02:00

feat: add daemon option max-concurrent-uploads (#18)

This commit is contained in:
Robert Kaussow 2023-09-03 22:33:59 +02:00 committed by GitHub
parent ecf9348149
commit 787934288e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 19 deletions

View File

@ -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

View File

@ -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,
},

View File

@ -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)
}

View File

@ -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.