-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (34 loc) · 1.44 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
TAG ?= $(shell date +%Y-%m-%d-%H%M%S)
IMAGE ?= "swarmer"
help:
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
git-pull: ## Pull the latest changes from the remote GIT repository
git-pull:
git pull
build: ## same as build-no-cache
build: test
docker build --pull=true -t $(IMAGE):$(TAG) .
echo $(TAG) > .last_tag
build-no-pull: ## git-pull build using local cache not to pulling a fresh image from docker repository
build-no-pull: test git-pull
docker build -f -t $(IMAGE):$(TAG) .
echo $(TAG) > .last_tag
build-no-cache: ## git-pull and build IGNORING local cache and force to pull a fresh image from docker repository
build-no-cache: test git-pull
docker build --no-cache --pull=true -t $(IMAGE):$(TAG) .
echo $(TAG) > .last_tag
push: ## Push last generated build
push: test
test -s .last_tag || (echo You need to build first ; exit 1)
docker push $(IMAGE):`cat .last_tag` && \
rm -f .last_tag
push-latest: ## Push local latest tag
push-latest: test
docker push $(IMAGE):latest
latest: ## Link last build (tag) to the tag latest
latest: build
test -s .last_tag || (echo You need to build first ; exit 1)
docker tag -f $(IMAGE):`cat .last_tag` $(IMAGE):latest
test: ## Run necessary tests
@test -n "$(IMAGE)" || (echo TEST ERROR: You MUST specify IMAGE variable, type make help ; exit 1)
@test -f ./Dockerfile || (echo TEST ERROR: There is no Dockerfile.$(IMAGE) in this directory. ; exit 1)