github.com/puellanivis/breton@v0.2.16/masher/Makefile (about)

     1  .PHONY: all clean install container push
     2  
     3  TIMESTAMP:=$(shell date +"%Y%m%d.%H%M")
     4  
     5  ifneq "$(DOCKER_REGISTRY)" ""
     6  #REGISTRY:=$(DOCKER_REGISTRY)/
     7  endif
     8  
     9  PROJECT:=$(shell basename "${PWD}")
    10  USER   :=$(shell id -un | tr '[:upper:]' '[:lower:]' | grep -o '[^\\]*$$')
    11  REPO   :=${REGISTRY}${USER}/${PROJECT}
    12  BUILDNO:=$(shell docker images ${REPO} | grep -c ${TIMESTAMP})
    13  
    14  BUILDTAG:=
    15  ifneq "$(BUILDNO)" "0"
    16  BUILDTAG:=-$(BUILDNO)
    17  endif
    18  
    19  all: container
    20  
    21  clean:
    22  	docker rmi --force `docker images -q ${REPO}`
    23  
    24  install:
    25  	mkdir -p $(HOME)/bin
    26  	cp masher $(HOME)/bin/
    27  
    28  container:
    29  	docker build --rm --network=host --build-arg PROJECT=${PROJECT} -t ${REPO}:${TIMESTAMP}${BUILDTAG} -t ${REPO}:latest .
    30  
    31  push:
    32  	[ -n "${BRANCH}" ] && docker push ${REPO}:${BRANCH} || true
    33  	docker push ${REPO}:latest