-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
50 lines (41 loc) · 1.08 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
46
47
48
49
50
ifndef $(APP)
APP := ssh-tunneler
endif
ifndef $(RELEASE)
RELEASE := $(shell git tag -l --points-at HEAD)
endif
BRANCH := $(shell git rev-parse --abbrev-ref HEAD | perl -ne 'print lc' | tr /: -)
COMMIT := $(BRANCH)-$(shell git rev-parse --short HEAD)
REGISTRY := eu.gcr.io/sysops-1372
REPOSITORY := $(REGISTRY)/$(APP)
all: docker-image
clean: docker-rmi
ci-build: docker-image docker-push write-version docker-rmi
ci-deploy: deis-deploy
docker-image:
docker build --force-rm -t $(REPOSITORY):$(COMMIT) .
ifneq ($(RELEASE),)
docker tag $(REPOSITORY):$(COMMIT) $(REPOSITORY):$(RELEASE)
endif
docker-push:
docker push $(REPOSITORY):$(COMMIT)
ifneq ($(RELEASE),)
docker push $(REPOSITORY):$(RELEASE)
endif
write-version:
ifneq ($(RELEASE),)
echo release=$(RELEASE) > ci-vars.txt
else
echo release=$(COMMIT) > ci-vars.txt
endif
docker-rmi:
docker rmi $(REPOSITORY):$(COMMIT)
ifneq ($(RELEASE),)
docker rmi $(REPOSITORY):$(RELEASE)
endif
deis-deploy:
ifneq ($(RELEASE),)
deis pull $(REPOSITORY):$(RELEASE) -a $(APP)
else
deis pull $(REPOSITORY):$(COMMIT) -a $(APP)
endif