-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
119 lines (95 loc) · 4.12 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
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
.PHONY: default
default: runner.image dev.image core.image service.image dsmlp.image
.PHONY: setup
setup:
pip install -e .
python -m pip install -e .
#.PHONY: requirements.txt
#requirements.txt:
# pip freeze --all --local --exclude-editable | grep -v DJR | grep -v LabPython | grep -v pygobject | grep -v python-apt > $@
# # python -m pip freeze --all --local --exclude-editable jupyter_requirements.txt
BUILD_ARGS=--build-arg GOOGLE_CREDENTIALS_FILE=$(GOOGLE_CREDENTIALS_FILE)\
--build-arg GOOGLE_APPLICATION_CREDENTIALS=$(GOOGLE_APPLICATION_CREDENTIALS)\
--build-arg GOOGLE_CLOUD_PROJECT=$(GOOGLE_CLOUD_PROJECT)\
--build-arg DJR_DOCKER_SCRATCH=$(DJR_DOCKER_SCRATCH)\
--build-arg DOCKER_DEVEL_IMAGE=$(DOCKER_DEVEL_IMAGE)\
--build-arg DOCKER_CORE_IMAGE=$(DOCKER_CORE_IMAGE)\
--build-arg DOCKER_RUNNER_IMAGE=$(DOCKER_RUNNER_IMAGE)\
--build-arg DOCKER_SERVICE_IMAGE=$(DOCKER_SERVICE_IMAGE)\
--build-arg DOCKER_BASE_IMAGE=$(DOCKER_BASE_IMAGE) \
--build-arg CLOUD_MODE=$(CLOUD_MODE) \
--build-arg DJR_SERVER=$(DJR_SERVER) \
--build-arg ARCHLAB_ROOT=$(ARCHLAB_ROOT) \
--build-arg PIN_ROOT=$(PIN_ROOT) \
--build-arg MONETA_ROOT=$(MONETA_ROOT) \
--build-arg CANELA_ROOT=$(CANELA_ROOT) \
--build-arg DJR_JOB_TYPE=$(DJR_JOB_TYPE) \
--build-arg JUPYTER_CONFIG_DIR=$(JUPYTER_CONFIG_DIR) \
--build-arg DJR_CLUSTER=$(DJR_CLUSTER)
SUBDIRS=cse141pp-archlab CSE141pp-LabPython CSE141pp-DJR CSE141pp-Tool-Moneta CSE141pp-SimpleCNN CSE141pp-Tool-Moneta-Pin
export SUBDIRS
core.image: IMAGE_NAME=$(DOCKER_CORE_IMAGE)
dev.image: IMAGE_NAME=$(DOCKER_DEVEL_IMAGE)
runner.image: IMAGE_NAME=$(DOCKER_RUNNER_IMAGE)
base.image: IMAGE_NAME=$(DOCKER_BASE_IMAGE)
service.image: IMAGE_NAME=$(DOCKER_SERVICE_IMAGE)
dsmlp.image: IMAGE_NAME=$(DOCKER_DSMLP_IMAGE)
test.image: IMAGE_NAME=test-image
test2.image: IMAGE_NAME=test2-image
IMAGES=$(DOCKER_DEVEL_IMAGE) $(DOCKER_CORE_IMAGE) $(DOCKER_RUNNER_IMAGE) $(DOCKER_SERVICE_IMAGE) $(DOCKER_USER_IMAGE) $(DOCKER_DSMLP_IMAGE)
atest:
echo $(IMAGES)
core.image:
dev.image: service.image
service.image: base.image
base.image: core.image
runner.image : base.image
dsmlp.image: service.image
test.image:
ifeq ($(CACHE),yes)
BUILD_OPTS=
else
BUILD_OPTS=--no-cache
endif
%.image: dockerfiles/%.docker
#>ifneq ($(REBUILD),yes)
# @[ "$$(docker images -q $(IMAGE_NAME))." = "." ] || (echo "$(IMAGE_NAME) already exists\n\n" && false)
# endif
#--progress plain
[ "$$PWD" = "/cse142L" ]
docker build --file $< -t $(IMAGE_NAME) --build-arg ARG_THIS_DOCKER_IMAGE=$(IMAGE_NAME) --build-arg CSE142L_ROOT=$(CSE142L_ROOT) $(BUILD_ARGS) $(BUILD_OPTS) --build-arg ARG_THIS_DOCKER_IMAGE_UUID=$(shell uuidgen) .
#2>&1 | tee $*.log
docker tag $(IMAGE_NAME) $(subst $(DOCKER_IMAGE_VERSION),latest,$(IMAGE_NAME))
touch $@
.PHONY: perms
perms:
@echo $(DOCKER_ACCESS_TOKEN) | docker login --password-stdin --username $(DOCKER_USERNAME) #>/dev/null 2>&1
.PHONY: clean
clean:
rm -rf *.image
.PHONY:bootstrap
bootstrap:
python3 -m venv ./.bootstrap-venv
(. .bootstrap-venv/bin/activate; pip install wheel;cd CSE141pp-LabPython; make setup; cd ../CSE141pp-DJR; make setup)
.PHONY:test
test:
$(MAKE) -C CSE141pp-DJR test
$(MAKE) -C CSE141pp-LabPython test
.PHONY: push
push: perms
for i in $(IMAGES); do docker push $$i; done
for i in $(subst :$(DOCKER_IMAGE_VERSION),:latest,$(IMAGES)); do docker push $$i; done
.PHONY: pull
pull: perms
-for i in $(IMAGES); do docker pull $$i; done
-for i in $(subst :$(DOCKER_IMAGE_VERSION),:latest,$(IMAGES)); do docker pull $$i; done
.PHONY: update-lab-tag
update-lab-tag:
@[ "$(LAB_NUM)" != "" ] || (echo You need to set LAB_NUM && false)
docker tag stevenjswanson/cse142l-runner:latest stevenjswanson/cse142l-runner:24wi-lab-$(LAB_NUM); docker push stevenjswanson/cse142l-runner:24wi-lab-$(LAB_NUM)
DOCKER_STACKS_DEP_CHAIN=base-notebook minimal-notebook scipy-notebook
.PHONY: docker-stacks
docker-stacks:
[ -d docker-stacks ] || git clone https://github.com/jupyter/docker-stacks.git
for i in $(DOCKER_STACKS_DEP_CHAIN); do $(MAKE) -C docker-stacks build/$$i OWNER=stevenjswanson DARGS="--build-arg PYTHON_VERSION=3.7 --no-cache"; done
for i in $(DOCKER_STACKS_DEP_CHAIN); do $(MAKE) -C docker-stacks push/$$i OWNER=stevenjswanson ;done