diff --git a/.travis.yml b/.travis.yml
index 0b00b022748f0d08192b54844c8fb198cb7508b2..f553603d813693040d753ec7480eee6b24d5154c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
 sudo: required
 services:
-  - docker 
+  - docker
 
 language: go
 
@@ -34,7 +34,7 @@ script:
 
 deploy:
   provider: script
-  script: "./build-docker-push"
+  script: "./build-docker push"
   skip_cleanup: true
   on:
     branch: master
diff --git a/Documentation/dev-guide.md b/Documentation/dev-guide.md
index 611fd4465d8c3cdcd359b225a8de0e9ea1a84310..e9dcdf9a5dbd77e78db602c12a70d402d2c112db 100644
--- a/Documentation/dev-guide.md
+++ b/Documentation/dev-guide.md
@@ -34,10 +34,16 @@ You can also use a copy of `go` hosted inside a Docker container if you prefix y
 
 Once binaries are compiled you can build and push a dex image to quay.io. Before doing this step binaries must be built above using one of the build tools.
 
+```console
+./build-docker build
+```
+
+If you want to push the build to quay.io, use `./build-docker push`:
+
 ```console
 export DOCKER_USER=<<your user>>
 export DOCKER_PASSWORD=<<your password>>
-./build-docker-push
+./build-docker push
 ```
 
 By default the script pushes to `quay.io/coreos/dex`; if you want to push to a different repository, override the `DOCKER_REGISTRY` and `DOCKER_REPO` environment variables.
@@ -102,7 +108,7 @@ Note that __all of these flags are manditory__. This should add an entry to the
 
 ## Updating an existing package
 
-To update an existing package, edit the `glide.yaml` file to the desired verison (most likely a git hash), and run `glide update`. 
+To update an existing package, edit the `glide.yaml` file to the desired verison (most likely a git hash), and run `glide update`.
 
 ```
 {{ edit the entry in glide.yaml }}
diff --git a/build-docker b/build-docker
new file mode 100755
index 0000000000000000000000000000000000000000..47de72786a92c0189536034ed245693a1f3c4a06
--- /dev/null
+++ b/build-docker
@@ -0,0 +1,40 @@
+#!/bin/bash -e
+#
+# Build the docker container and push it to quay
+# ./build-docker push
+#
+# Build the docker container locally without pushing to registry
+# ./build-docker build
+
+DOCKER_REGISTRY=${DOCKER_REGISTRY:=quay.io}
+DOCKER_REPO=${DOCKER_REPO:=coreos/dex}
+repo=$DOCKER_REGISTRY/$DOCKER_REPO
+
+version=$(./git-version)
+
+stage() {
+  echo -e "\033[36m----> $1\033[0m"
+}
+
+build() {
+  stage "build $repo:$version"
+  docker build -q --rm=true -t $repo:$version .
+  docker tag $repo:$version $repo:latest
+}
+
+push() {
+  stage "push image $repo:$version"
+  if [ -v $DOCKER_USER ] || [ -v $DOCKER_PASSWORD ]; then
+      echo "env variables not set: DOCKER_USER, DOCKER_PASSWORD. skipping login, assuming creds in .dockercfg"
+  else
+      echo logging in as $DOCKER_USER
+      docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD" --email="dex@example.com" $DOCKER_REGISTRY
+  fi
+
+  docker push $repo:$version
+  docker push $repo:latest
+}
+
+test -z "$1" && build && push
+test "$1" = "push" && build && push
+test "$1" = "build" && build
diff --git a/build-docker-push b/build-docker-push
deleted file mode 100755
index cd9e96627ffbe034fad61b212209493be3aa3eb8..0000000000000000000000000000000000000000
--- a/build-docker-push
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash -e
-
-
-DOCKER_REGISTRY=${DOCKER_REGISTRY:=quay.io}
-DOCKER_REPO=${DOCKER_REPO:=coreos/dex}
-repo=$DOCKER_REGISTRY/$DOCKER_REPO
-
-if [ -v $DOCKER_USER ] || [ -v $DOCKER_PASSWORD ]; then
-    echo "env variables not set: DOCKER_USER, DOCKER_PASSWORD. skipping login, assuming creds in .dockercfg"
-else
-    echo logging in as $DOCKER_USER
-    docker login --username="$DOCKER_USER" --password="$DOCKER_PASSWORD" --email="dex@example.com" $DOCKER_REGISTRY
-fi
-
-version=$(./git-version)
-
-docker build -q --rm=true -t $repo:$version .
-docker tag -f $repo:$version $repo:latest
-docker push $repo:$version
-docker push $repo:latest