update makefile with better dockerhub support
This commit is contained in:
parent
cf51968fb9
commit
563bd4f16c
10
Makefile
10
Makefile
@ -1,6 +1,7 @@
|
|||||||
VERSION := $(shell git rev-parse --short HEAD)
|
VERSION := $(shell git rev-parse --short HEAD)
|
||||||
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||||
BUILDTIMEFILENAME := $(shell date -u '+%Y%m%d-%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)
|
BUILDUSER := $(shell whoami)
|
||||||
BUILDHOST := $(shell hostname -s)
|
BUILDHOST := $(shell hostname -s)
|
||||||
BUILDARCH := $(shell uname -m)
|
BUILDARCH := $(shell uname -m)
|
||||||
@ -33,9 +34,16 @@ fmt:
|
|||||||
test: build-docker-image
|
test: build-docker-image
|
||||||
|
|
||||||
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
|
dist: build-docker-image
|
||||||
-mkdir -p ./output
|
-mkdir -p ./output
|
||||||
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
|
docker run --rm --entrypoint cat $(IMAGENAME) /bin/$(FN) > output/$(FN)
|
||||||
docker save $(IMAGENAME) | bzip2 > output/$(BUILDTIMEFILENAME).$(FN).tbz2
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user