This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (55 loc) · 1.66 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
51
52
53
54
55
56
57
58
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
DEVICE := $(shell netstat -rn -A inet | grep ^0.0.0.0 | tr ' ' '\n' | tail -n1)
else
DEVICE := $(shell netstat -rn -f inet | grep -v "link\#" | grep ^default | tr ' ' '\n' | tail -n1)
endif
start:
ifneq (, $(shell ifconfig | grep "192.168.65.1"))
ifeq ($(UNAME), Linux)
@echo "---- LINUX, CLEANING OLD IP ALIAS ----"
sudo ifconfig $(DEVICE):tugboat 192.168.65.1 down || true
else
@echo "---- MAC, CLEANING OLD IP ALIAS ----"
sudo ifconfig $(DEVICE) -alias 192.168.65.1 || true
endif
endif
ifneq (, $(shell ifconfig | grep "192.168.65.2"))
ifeq ($(UNAME), Linux)
@echo "---- LINUX, CLEANING OLD IP ALIAS ----"
sudo ifconfig $(DEVICE):tugboat 192.168.65.2 down || true
else
@echo "---- MAC, CLEANING OLD IP ALIAS ----"
sudo ifconfig $(DEVICE) -alias 192.168.65.2 || true
endif
endif
docker-compose stop
docker-compose rm -f
docker-compose pull
docker-compose build --pull
ifneq (, $(shell docker info | grep "provider=virtualbox"))
@echo "---- YOU ARE RUNNING DOCKER TOOLBOX ----"
TUGBOAT_IP=192.168.99.100 docker-compose up
else
@echo "---- YOU ARE RUNNING DOCKER FOR MAC/LINUX ----"
ifneq (, $(shell ifconfig | grep "10.156.156.1"))
@echo "---- IP FOUND ----"
else
ifeq ($(UNAME), Linux)
@echo "---- LINUX, ADDING IP ALIAS ----"
sudo ifconfig $(DEVICE):tugboat 10.156.156.1 up
else
@echo "---- MAC, ADDING IP ALIAS ----"
sudo ifconfig $(DEVICE) alias 10.156.156.1 255.255.255.0
endif
endif
TUGBOAT_IP=10.156.156.1 docker-compose up
endif
stop:
docker-compose stop
docker-compose rm -f
ifeq ($(UNAME), Linux)
sudo ifconfig $(DEVICE):tugboat 10.156.156.1 down || true
else
sudo ifconfig $(DEVICE) -alias 10.156.156.1 || true
endif