-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (63 loc) · 1.75 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
help:
@echo ""
@echo "-- Help Menu"
@echo "" This is merely a base image for usage read the README file
@echo "" 1. make run - run docker container
@echo "" 2. make build - build docker container
@echo "" 3. make clean - kill and remove docker container
@echo "" 4. make enter - execute an interactive bash in docker container
@echo "" 5. make logs - follow the logs of docker container
@echo "" 6. make pull - pull the latest docker container
build: NAME TAG builddocker
# run a plain container
run: rm rundocker
rundocker:
$(eval NAME := $(shell cat NAME))
$(eval TAG := $(shell cat TAG))
@docker run --name=$(NAME) \
--cidfile="cid" \
--env-file=env \
-t $(TAG)
# run a container with a mounted TMP
# useful for debugging and getting the config out to test it
tmp: build rm rundockerwtmp
rundockerwtmp:
$(eval TMP := $(shell mktemp -d --suffix=DOCKERTMP))
$(eval NAME := $(shell cat NAME))
$(eval TAG := $(shell cat TAG))
@docker run --name=$(NAME) \
--cidfile="cid" \
-v $(TMP):/tmp \
--env-file=env \
-t $(TAG)
# run a container in debug
# run everything else
debug: build rm rundockerdebug
rundockerdebug:
$(eval TMP := $(shell mktemp -d --suffix=DOCKERTMP))
$(eval NAME := $(shell cat NAME))
$(eval TAG := $(shell cat TAG))
@docker run --name=$(NAME) \
--cidfile="cid" \
-v $(TMP):/tmp \
--env-file=env \
-t $(TAG) /bin/sh
# pull the latest copy from docker hub
pull:
docker pull `cat TAG`
# build the container locally
builddocker:
/usr/bin/time -v docker build -t `cat TAG` .
kill:
-@docker kill `cat cid`
rm-image:
-@docker rm `cat cid`
-@rm cid
rm: kill rm-image
clean: rm
enter:
docker exec -i -t `cat cid` /bin/bash
logs:
docker logs -f `cat cid`
env:
cp -i emr.env.example env