-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
65 lines (56 loc) · 1.51 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
# +--------------------+
# | BUILD IMAGE | -------+ EXE
# +--------------------+ |
# | | v
# | DEV IMAGE +-------------------+
# | | RUNTIME IMAGE |
# +--------------------+-------------------+
# | LIB IMAGE |
# +----------------------------------------+
# | UBUNTU IMAGE |
# +----------------------------------------+
default: docker-run
# LIB DOCKER IMAGE: RUNTIME FOR THIS PROJECT ADDED ON TOP "UBUNTU"
docker-lib:
@ln -sf ./etc/docker/lib/Dockerfile .
@docker build \
--tag=rifactor:lib \
$(PWD)
# DEV DOCKER IMAGE: DEV TOOLS FOR THIS PROJECT ADDED ON TOP "LIB"
docker-dev:
@ln -sf ./etc/docker/dev/Dockerfile .
@docker build \
--rm=false \
--tag=rifactor:dev \
$(PWD)
# BLD DOCKER IMAGE: BUILD/TEST THIS PROJECT ON TOP OUR "DEV" IMAGE
docker-bld:
@ln -sf ./etc/docker/bld/Dockerfile .
@docker build \
--rm=false \
--tag=rifactor:bld \
$(PWD)
# EXTRACT BINARY: COPY THE BINARY EXE FROM OUR PROJECT "BLD" IMAGE
rifactor: docker-bld
@docker run \
--volume=$(TMP):/host \
rifactor:bld \
cp /root/.local/bin/rifactor /host/
@cp $(TMP)/rifactor .
# RUN DOCKER IMAGE: ADD THE PROJECT'S BINARY ON TOP OUR "LIB" IMAGE
docker-run: | rifactor
@ln -sf ./etc/docker/run/Dockerfile .
@docker build \
--tag=rifactor \
$(PWD)
clean:
@rm -f Dockerfile rifactor
.PHONY: \
clean \
default \
docker \
docker-bld \
docker-dev \
docker-lib \
docker-run
TMP := $(shell mktemp -d)