Created
April 1, 2015 14:16
-
-
Save thbkrkr/fa1bee34a2f0e93b828e to your computer and use it in GitHub Desktop.
Build, tag and push Docker image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ORG = krkr | |
NAME = blurb | |
SHA1 = $(shell git log -1 --pretty=oneline | cut -c-10) | |
BRANCH = $(shell git branch -a --contains $(SHA1) | egrep '(remotes/|\*)' | egrep -v "(HEAD|detached)" | head -1 | sed -e "s/\* //" -e "s/.*\///") | |
VERSION = $(BRANCH)-$(SHA1) | |
REGISTRY = registry.blurb.com | |
build: | |
docker build --rm -t $(ORG)/$(NAME):${VERSION} . | |
docker tag -f $(ORG)/$(NAME):${VERSION} $(ORG)/$(NAME):$(BRANCH)-latest | |
push: | |
docker tag -f $(ORG)/$(NAME):${VERSION} $(REGISTRY)/$(ORG)/$(NAME):${VERSION} | |
docker tag -f $(ORG)/$(NAME):${VERSION} $(REGISTRY)/$(ORG)/$(NAME):$(BRANCH)-latest | |
docker push $(REGISTRY)/$(ORG)/$(NAME) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment