-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
46 lines (33 loc) · 1.06 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
ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
BUILDER := local/builder
IMAGE := alectolytic/cayley
REPOSITORY := docker.io/$(IMAGE)
VERSION := f143602b
BUILD_OPTS :=
ifdef NOCACHE
BUILD_OPTS := $(BUILD_OPTS) --no-cache
endif
.PHONY: all build clean tag tag/$(VERSION) push push/$(VERSION)
all: build
build:
@docker build $(BUILD_OPTS) -t $(BUILDER) $(ROOT)
@docker run \
--privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(shell which docker):$(shell which docker) \
-it $(BUILDER)
tag/$(VERSION):
@docker tag -f $(IMAGE):latest $(REPOSITORY):$(VERSION)
tag: tag/$(VERSION)
@docker tag -f $(REPOSITORY):$(VERSION) $(REPOSITORY):latest
push/$(VERSION): tag
@docker push $(REPOSITORY):$(VERSION)
push: | push/$(VERSION)
@docker push $(REPOSITORY):latest
bumpversion:
@sed -i s/'ENV VERSION .*$$'/'ENV VERSION $(VERSION)'/ $(ROOT)/Dockerfile
@sed -ie s/'^\(VERSION\s*:=\s\).*$$'/'\1$(VERSION)'/ $(ROOT)/Makefile
@git add $(ROOT)/Dockerfile $(ROOT)/Makefile
@git commit -m "Update to $(VERSION)"
clean:
@docker rmi -f $(BUILDER)