From 2afde63543323a5d2348aee1320dc1c4b2e10d90 Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 20 May 2016 12:58:22 -0700 Subject: [PATCH 1/4] Fix typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93318d6..1064578 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# drone-git +# drone-docker Drone plugin can be used to build and publish Docker images to a container registry. For the usage information and a listing of the available options please take a look at [the docs](DOCS.md). From b7baf89e8cbb238154c5dfb01749b3e7d12ec24c Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 20 May 2016 12:59:51 -0700 Subject: [PATCH 2/4] Fix typo in env variable --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 7569da3..b5f85ab 100644 --- a/main.go +++ b/main.go @@ -40,7 +40,7 @@ func main() { cli.StringFlag{ Name: "daemon.mirror", Usage: "docker daemon registry mirror", - EnvVar: "PLUGIN_REGISTRY", + EnvVar: "PLUGIN_MIRROR", }, cli.StringFlag{ Name: "daemon.storage-driver", From 5b55b013730a8825fd0a5d71bca60bd985484781 Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 20 May 2016 13:00:06 -0700 Subject: [PATCH 3/4] Using official dind image --- Dockerfile | 8 ++++---- plugin.go | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9cf078c..74a0d38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ # # docker build --rm=true -t plugins/docker . -FROM rancher/docker:v1.10.2 +FROM docker:1.11-dind -ADD drone-docker /usr/bin/ -VOLUME /var/lib/docker -ENTRYPOINT ["/usr/bin/dockerlaunch", "/usr/bin/drone-docker"] +ADD drone-docker /go/bin/ + +ENTRYPOINT ["/go/bin/drone-docker"] diff --git a/plugin.go b/plugin.go index fd15d13..ac94535 100644 --- a/plugin.go +++ b/plugin.go @@ -119,10 +119,12 @@ func (p Plugin) Exec() error { return nil } +const dockerExe = "/usr/local/bin/docker" + // helper function to create the docker login command. func commandLogin(login Login) *exec.Cmd { return exec.Command( - "/usr/bin/docker", "login", + dockerExe, "login", "-u", login.Username, "-p", login.Password, "-e", login.Email, @@ -132,18 +134,18 @@ func commandLogin(login Login) *exec.Cmd { // helper function to create the docker info command. func commandVersion() *exec.Cmd { - return exec.Command("/usr/bin/docker", "version") + return exec.Command(dockerExe, "version") } // helper function to create the docker info command. func commandInfo() *exec.Cmd { - return exec.Command("/usr/bin/docker", "info") + return exec.Command(dockerExe, "info") } // helper function to create the docker build command. func commandBuild(build Build) *exec.Cmd { cmd := exec.Command( - "/usr/bin/docker", "build", + dockerExe, "build", "--pull=true", "--rm=true", "-f", build.Dockerfile, @@ -163,14 +165,14 @@ func commandTag(build Build, tag string) *exec.Cmd { target = fmt.Sprintf("%s:%s", build.Repo, tag) ) return exec.Command( - "/usr/bin/docker", "tag", source, target, + dockerExe, "tag", source, target, ) } // helper function to create the docker push command. func commandPush(build Build, tag string) *exec.Cmd { target := fmt.Sprintf("%s:%s", build.Repo, tag) - return exec.Command("/usr/bin/docker", "push", target) + return exec.Command(dockerExe, "push", target) } // helper function to create the docker daemon command. @@ -192,7 +194,7 @@ func commandDaemon(daemon Daemon) *exec.Cmd { for _, dns := range daemon.DNS { args = append(args, "--dns", dns) } - return exec.Command("/usr/bin/docker", args...) + return exec.Command(dockerExe, args...) } // trace writes each command to stdout with the command wrapped in an xml From 0788dce1845085a4a7d0c7b8cd725c48bf38cdf1 Mon Sep 17 00:00:00 2001 From: Don Date: Fri, 20 May 2016 13:18:13 -0700 Subject: [PATCH 4/4] Moving where exe is placed --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74a0d38..babd7f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,6 @@ FROM docker:1.11-dind -ADD drone-docker /go/bin/ +ADD drone-docker /bin/ -ENTRYPOINT ["/go/bin/drone-docker"] +ENTRYPOINT ["/bin/drone-docker"]