-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
45 lines (40 loc) · 1.85 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
default: help
docker_image: dockerized-mesos/.dockerized_mesos.created ## Create the calico/mesos-calico image
docker_image.tar: dist/docker/mesos-calico.tar ## Create the calico/mesos-calico image, and tar it.
# TODO: maybe change this so docker runs and handles the caching itself,
# instead of relying on the .created file.
dockerized-mesos/.dockerized_mesos.created:
docker build -t calico/mesos-calico .
touch dockerized-mesos/.mesos_calico_image.created
# Tar up the calico/mesos-calico docker image
dist/docker/mesos-calico.tar: docker_image
mkdir -p dist/docker
docker save -o dist/docker/mesos-calico.tar calico/mesos-calico
## Create the calico-mesos RPM
rpm:
mkdir -p -m 777 dist/rpm/
docker build -t calico/mesos-rpm-builder ./packages
docker run \
-v `pwd`/dist/rpm/:/root/rpmbuild/RPMS/ \
calico/mesos-rpm-builder
## Clean everything (including stray volumes)
clean:
find . -name '*.created' -exec rm -f {} +
-rm -rf dist
-rm -f mesos-calico.tar
-docker rmi calico/mesos-calico
-docker rmi calico/mesos-rpm-builder
help: # Some kind of magic from https://gist.github.com/rcmachado/af3db315e31383502660
$(info Available targets)
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
nb = sub( /^## /, "", helpMsg ); \
if(nb == 0) { \
helpMsg = $$0; \
nb = sub( /^[^:]*:.* ## /, "", helpMsg ); \
} \
if (nb) \
printf "\033[1;31m%-" width "s\033[0m %s\n", $$1, helpMsg; \
} \
{ helpMsg = $$0 }' \
width=$$(grep -o '^[a-zA-Z_0-9]\+:' $(MAKEFILE_LIST) | wc -L) \
$(MAKEFILE_LIST)