Skip to content

Instantly share code, notes, and snippets.

@mccurdyc
Created October 5, 2018 18:41
Show Gist options
  • Save mccurdyc/8af2918e5c42ff31f19d41c7e2eaf125 to your computer and use it in GitHub Desktop.
Save mccurdyc/8af2918e5c42ff31f19d41c7e2eaf125 to your computer and use it in GitHub Desktop.
default: build
current_tag:
@echo $(shell git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`)
build:
dep ensure -v
GOOS=linux GOARCH=amd64 go build -o bin/project .
build_container: build
$(eval V := $(shell echo $(VERSION) | sed -e s/v//g ))
@echo BUILDING docker image with tag: $(V)
docker build -f build/docker/Dockerfile -t mccurdyc/projectname:$(V) -t mccurdyc/projectname:latest .
tag:
@echo creating and pushing GitHub release tag \"$(VERSION)\" with message \"$(MESSAGE)\"
git tag $(VERSION) -m "$(MESSAGE)"
git push --tags
release: tag build_container
$(eval V := $(shell echo $(VERSION) | sed -e s/v//g ))
@echo PUSHING docker image with tag: $(V)
docker push mccurdyc/projectname:$V && \
docker push mccurdyc/projectname:latest
run: build
docker-compose -f build/docker/docker-compose.yml up --build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment