update makefile with better dockerhub support

This commit is contained in:
Jeffrey Paul 2019-10-24 08:33:57 -07:00
parent cf51968fb9
commit 563bd4f16c
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,7 @@
VERSION := $(shell git rev-parse --short HEAD)
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
BUILDTIMEFILENAME := $(shell date -u '+%Y%m%d-%H%M%SZ')
BUILDTIMETAG := $(shell date -u '+%Y%m%d%H%M%S')
BUILDUSER := $(shell whoami)
BUILDHOST := $(shell hostname -s)
BUILDARCH := $(shell uname -m)
@ -33,9 +34,16 @@ fmt:
test: build-docker-image
build-docker-image:
docker build -t $(IMAGENAME) .
docker build -t $(IMAGENAME):$(VERSION) -t $(IMAGENAME):latest -t $(IMAGENAME):$(BUILDTIMETAG) .
dist: build-docker-image
-mkdir -p ./output
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2
hub: upload-docker-image
upload-docker-image: build-docker-image
docker push $(IMAGENAME):$(VERSION)
docker push $(IMAGENAME):$(BUILDTIMETAG)
docker push $(IMAGENAME):latest