From 84a43a3d2874be3cb299b5bfb61ca7d83a5c8b63 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Mon, 11 Mar 2019 15:26:52 -0400 Subject: [PATCH] Enable push of images to DockerHub This patch will enable pushes of any successful builds (using Travis-CI) of the 'master' branch to the proper repository on DockerHub. The credentials necessary are provided via environment variables configured in the Travis-CI settings. Addresses issue #27 Signed-off-by: Kevin P. Fleming --- .travis.yml | 5 +++++ Makefile | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79d0c51..4ea1efc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,3 +24,8 @@ script: - make clean && make build-multistage - docker images - docker run `make version` --help + +after_success: + - if [[ "$TRAVIS_BRANCH" == "master" ]]; then + docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" && make tag && make push; + fi diff --git a/Makefile b/Makefile index 3a6001d..e60c60e 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ bin ?= goldpinger pkg ?= "github.com/bloomberg/goldpinger" tag = $(name):$(version) goos ?= ${GOOS} -namespace ?= "" +namespace ?= "bloomberg/" files = $(shell find . -iname "*.go") @@ -38,7 +38,7 @@ push: run: go run ./cmd/goldpinger/main.go - + version: @echo $(tag)