-
Notifications
You must be signed in to change notification settings - Fork 9
/
Docker-Makefile
120 lines (88 loc) · 3.25 KB
/
Docker-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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# https://github.com/Miroka96/docker-makefile
# rename this file for convenience to 'Makefile'
CONTAINERNAME := opossum
NAME := hyrise/${CONTAINERNAME}
TAG := 1.0
VOLUME := ${PWD}
MOUNTPATH := /project
# if you want a special image name, edit this
IMAGE := $(NAME):$(TAG)
# if you have no volume, delete the right part
VOLUMEMOUNTING := -v $(VOLUME):$(MOUNTPATH)
PROGRAMRAW := docker run $(VOLUMEMOUNTING) --rm
PROGRAM := $(PROGRAMRAW) $(IMAGE)
DEBUGPROGRAMRAW := $(PROGRAMRAW) -p 127.0.0.1:7777:7777 -t --security-opt seccomp:unconfined --name ${CONTAINERNAME}
DEBUGPROGRAM := ${DEBUGPROGRAMRAW} ${IMAGE} debug
DEBUGPROGRAMDETACHED := ${DEBUGPROGRAMRAW} --detach ${IMAGE} debug
REMOTEDEBUGTARGET := tcp:127.0.0.1:7777
DEBUGNOTIFICATION := connect the debugger to ${REMOTEDEBUGTARGET}
CONTAINERBUILDDEPENDENCIES := Dockerfile run-container.sh install.sh .dockerignore
.PHONY: build-container build-container-nocache init-test build-container-test init
.PHONY: configure build lint format test coverage sanitize
.PHONY: debug-playground debug-playground-detached debug-test debug-test-detached
.PHONY: git-update ssh
.PHONY: stop-container clean-container clean
help:
@echo "* initialize the whole environment: 'make init'"
@echo " or use the following steps:"
@echo "- build the container using 'make build-container'"
@echo " (takes around 15 minutes)"
@echo "- update the git-submodules: 'make git-update'"
@echo "- configure your build target (default: debug): 'make configure'"
@echo "- build your target: 'make build'"
@echo "- run the tests: 'make test'"
@echo
@echo "* further manipulate your project using 'make lint|format|coverage|sanitize|debug|shell'"
@echo
@echo "* to start a remote debugger, run: 'make debug-playground|debug-test'"
@echo
@echo "* to use the GDB Remote Debugger in CLION:"
@echo "- create a new GDB Remote Debugger run configuration"
@echo "- set remote target to '${REMOTEDEBUGTARGET}'"
@echo "- add as path mapping: remote=/project local=${PWD}"
@echo "- add a new External Tool for make to run it automatically"
@echo " - use either debug-playground-detached or debug-test-detached as make target"
@echo
@echo "* get a shell inside the container: 'make shell'"
@echo " be aware that all changes are lost afterwards"
build-container: ${CONTAINERBUILDDEPENDENCIES}
docker build -t $(IMAGE) .
build-container-nocache: ${CONTAINERBUILDDEPENDENCIES}
docker build -t $(IMAGE) --no-cache .
init-test:
$(PROGRAM)
build-container-test: build-container init-test
init: build-container-test git-update configure build test
configure:
$(PROGRAM) configure
build:
$(PROGRAM) build
lint:
$(PROGRAM) lint
format:
$(PROGRAM) format
test:
$(PROGRAM) test
coverage:
$(PROGRAM) coverage
sanitize:
$(PROGRAM) sanitize
debug-playground: stop-container
${DEBUGPROGRAM} hyrisePlayground
debug-playground-detached: stop-container
${DEBUGPROGRAMDETACHED} hyrisePlayground
@echo ${DEBUGNOTIFICATION}
debug-test:
${DEBUGPROGRAM} hyriseTest
debug-test-detached: stop-container
${DEBUGPROGRAMDETACHED} hyriseTest
@echo ${DEBUGNOTIFICATION}
git-update:
$(PROGRAM) git-update
shell:
$(PROGRAMRAW) -it ${IMAGE} shell
stop-container:
-docker stop $(CONTAINERNAME)
clean-container:
-docker rm $(CONTAINERNAME)
clean: stop-container clean-container