diff --git a/packaging/root/etc/drone/drone.toml b/packaging/root/etc/drone/drone.toml index 06d17a9e7d..e8388ccd3a 100644 --- a/packaging/root/etc/drone/drone.toml +++ b/packaging/root/etc/drone/drone.toml @@ -29,7 +29,7 @@ datasource="/var/lib/drone/drone.sqlite" # firewall. # # When false, the system admin will need to manually add -# users to Drone through the admin screens. +# users to Drone through the admin screens. # # [registration] # open=true @@ -68,4 +68,5 @@ datasource="/var/lib/drone/drone.sqlite" # nodes=[ # "unix:///var/run/docker.sock", # "unix:///var/run/docker.sock" -# ] \ No newline at end of file +# ] +# net="bridge" diff --git a/shared/build/build.go b/shared/build/build.go index 1f0084e696..8b76339a19 100644 --- a/shared/build/build.go +++ b/shared/build/build.go @@ -10,6 +10,7 @@ import ( "strings" "time" + "github.com/drone/config" "github.com/drone/drone/shared/build/buildfile" "github.com/drone/drone/shared/build/docker" "github.com/drone/drone/shared/build/dockerfile" @@ -19,6 +20,10 @@ import ( "github.com/drone/drone/shared/build/script" ) +var ( + networkmode = config.String("worker-net", "") +) + // BuildState stores information about a build // process including the Exit status and various // Runtime statistics (coming soon). @@ -328,6 +333,7 @@ func (b *Builder) run() error { // configure if Docker should run in privileged mode host := docker.HostConfig{ Privileged: (b.Privileged && len(b.Repo.PR) == 0), + NetworkMode: *networkmode, } // debugging diff --git a/shared/build/docker/structs.go b/shared/build/docker/structs.go index be0aeaa03c..d30282f9cd 100644 --- a/shared/build/docker/structs.go +++ b/shared/build/docker/structs.go @@ -19,6 +19,7 @@ type KeyValuePair struct { type HostConfig struct { Binds []string ContainerIDFile string + NetworkMode string LxcConf []KeyValuePair Privileged bool PortBindings map[Port][]PortBinding