-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
50 lines (39 loc) · 1.5 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
VM_NAME = boot2k8s
ISO_NAME = $(VM_NAME).iso
DOCKER_EXEC := $(shell which docker)
VBOX_EXEC := $(shell which VBoxManage)
ifeq ($(DOCKER_EXEC),)
$(error No docker in PATH.)
endif
ifeq ($(VBOX_EXEC),)
$(error No VBoxManage in PATH.)
endif
all: build cat
build:
./builddeps.sh
$(DOCKER_EXEC) build -t $(VM_NAME) .
@echo ==============================================================
@echo Next step: start the VM with kubernetes with this command:
@echo make run
@echo ==============================================================
cat:
$(DOCKER_EXEC) run --rm $(VM_NAME) > $(ISO_NAME)
run:
$(VBOX_EXEC) createvm --name $(VM_NAME) --ostype "Linux_64" --register
$(VBOX_EXEC) storagectl $(VM_NAME) --name "IDE Controller" --add ide
$(VBOX_EXEC) storageattach $(VM_NAME) --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium ./$(ISO_NAME)
$(VBOX_EXEC) modifyvm $(VM_NAME) --memory 1024 --vrde on --vrdeaddress 127.0.0.1 --vrdeport 3390 --vrdeauthtype null
$(VBOX_EXEC) startvm $(VM_NAME) --type headless
$(VBOX_EXEC) controlvm $(VM_NAME) natpf1 k8s,tcp,,8080,,8080
@echo ==============================================================
@echo The VM has been started.
@echo Please wait few time and run this command to view your pod:
@echo ./kubectl get pods
@echo ==============================================================
stopvm:
$(VBOX_EXEC) controlvm $(VM_NAME) poweroff
clean:
$(DOCKER_EXEC) rmi $(VM_NAME)
rm -rf $(ISO_NAME) deps
cleanvm:
$(VBOX_EXEC) unregistervm $(VM_NAME) --delete