From eae495534be379fb87b13fa7d4a0062bba626fe5 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Fri, 11 Jul 2014 15:39:17 -0700 Subject: [PATCH] removed hard-coded Docker socket --- server/main.go | 2 +- server/worker/worker.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/server/main.go b/server/main.go index d708ce92..129c3934 100644 --- a/server/main.go +++ b/server/main.go @@ -94,7 +94,7 @@ func main() { queue := make(chan *worker.Request) workers := make(chan chan *worker.Request) worker.NewDispatch(queue, workers).Start() - worker.NewWorker(workers, users, repos, commits, configs, pubsub, &model.Server{Host: "unix:///tmp/sock.sock"}).Start() + worker.NewWorker(workers, users, repos, commits, configs, pubsub, &model.Server{}).Start() // setup the session managers sess := session.NewSession(users) diff --git a/server/worker/worker.go b/server/worker/worker.go index cc21160d..0fe151c1 100644 --- a/server/worker/worker.go +++ b/server/worker/worker.go @@ -110,8 +110,17 @@ func (w *worker) Execute(r *Request) { Depth: git.GitDepth(script.Git), } + // Instantiate a new Docker client + var dockerClient *docker.Client + switch { + case len(w.server.Host) == 0: + dockerClient = docker.New() + default: + dockerClient = docker.NewHost(w.server.Host) + } + // create an instance of the Docker builder - builder := build.New(docker.NewHost(w.server.Host)) + builder := build.New(dockerClient) builder.Build = script builder.Repo = repo builder.Stdout = buf