-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
81 lines (67 loc) · 2.83 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
80
81
# The binary to build (just the basename).
MODULE := autoballs
# Where to push the docker image.
# need to update!
REGISTRY := rdg31
IMAGE := $(REGISTRY)/$(MODULE)
# DISPLAY
DISPLAY := $(shell echo $(DISPLAY))
DATA_DIR := "/home/ryan/Google Drive/TFM Cambridge/2021/Frogs"
# This version-strategy uses git tags to set the version string
TAG := $(shell git describe --tags --always --dirty)
BLUE='\033[0;34m'
NC='\033[0m' # No Color
build-dev:
@echo "\n${BLUE}Building Development image with labels:\n"
@echo "name: $(MODULE)"
@echo "version: $(TAG)${NC}\n"
@sed \
-e 's|{NAME}|$(MODULE)|g' \
-e 's|{VERSION}|$(TAG)|g' \
docker/dev.Dockerfile | docker build -t $(IMAGE):$(TAG) -f- .
# Example: make shell CMD="-c 'date > datefile'"
shell: build-dev
@echo "\n${BLUE}Launching a shell in the containerized build environment...${NC}\n"
@xhost local:root
@docker run \
-e DISPLAY=$(DISPLAY) \
-v "/tmp/.X11-unix:/tmp/.X11-unix" \
-ti \
--rm \
--entrypoint /bin/bash \
-u 0 \
--mount type=bind,source=$(shell pwd)/,target=/autoballs\
--mount type=bind,source=$(DATA_DIR)/,target=/autoballs/data\
$(IMAGE):$(TAG) \
# Example: make shell CMD="-c 'date > datefile'"
shell-gpu: build-dev
@echo "\n${BLUE}Launching a shell in the containerized build environment...${NC}\n"
@xhost local:root
@docker run \
-e CURRENT_TAG=$(TAG) \
-e DISPLAY=$(DISPLAY) \
-v "/tmp/.X11-unix:/tmp/.X11-unix" \
-it \
--rm \
--entrypoint /bin/bash \
-u 0 \
--mount type=bind,source=$(shell pwd)/,target=/autoballs\
--mount type=bind,source=$(DATA_DIR)/,target=/autoballs/data\
--gpus all \
--ipc=host \
$(IMAGE):$(TAG) \
$(CMD)
shell-gpu-nx: build-dev
@echo "\n${BLUE}Launching a shell in the containerized build environment...${NC}\n"
@docker run \
-e CURRENT_TAG=$(TAG) \
-it \
--rm \
--entrypoint /bin/bash \
-u 0 \
--mount type=bind,source=$(shell pwd)/,target=/autoballs\
--mount type=bind,source=$(DATA_DIR)/,target=/autoballs/data\
--gpus all \
--ipc=host \
$(IMAGE):$(TAG) \
$(CMD)