Skip to content

Commit

Permalink
push latest image on push
Browse files Browse the repository at this point in the history
  • Loading branch information
maorfr committed Dec 3, 2018
1 parent df6e57c commit 97221fe
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ dockers:
dockerfile: Dockerfile
image_templates:
- "nuvo/{{.ProjectName}}:{{ .Tag }}"
- "nuvo/{{.ProjectName}}:latest"
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
deploy:
- provider: script
skip_cleanup: true
script: docker login -u $DOCKER_USER -p $DOCKER_PASSWORD && curl -sL https://git.io/goreleaser | bash
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ GIT_TAG := $(shell git describe --tags --always)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
LDFLAGS := "-X main.GitTag=${GIT_TAG} -X main.GitCommit=${GIT_COMMIT}"
DIST := $(CURDIR)/dist
DOCKER_USER := $(shell printenv DOCKER_USER)
DOCKER_PASSWORD := $(shell printenv DOCKER_PASSWORD)
TRAVIS := $(shell printenv TRAVIS)

all: bootstrap build

Expand All @@ -17,6 +20,24 @@ vet:
build: fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o bin/skbn cmd/skbn.go

# Build skbn docker image
docker: fmt vet
cp bin/skbn skbn
docker build -t nuvo/skbn:latest .
rm skbn


# Push will only happen in travis ci
push:
ifdef TRAVIS
ifdef DOCKER_USER
ifdef DOCKER_PASSWORD
docker login -u $(DOCKER_USER) -p $(DOCKER_PASSWORD)
docker push nuvo/skbn:latest
endif
endif
endif

bootstrap:
ifndef HAS_DEP
wget -q -O $(GOPATH)/bin/dep https://github.com/golang/dep/releases/download/$(DEP_VERSION)/dep-linux-amd64
Expand Down

0 comments on commit 97221fe

Please sign in to comment.