-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
140 lines (115 loc) · 7.19 KB
/
Makefile
File metadata and controls
140 lines (115 loc) · 7.19 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
NAME := numerai_predict
ECR_REPO := ${ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com
GIT_REF := $$(git rev-parse --short HEAD)
.DEFAULT_GOAL := help
.PHONY: help
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: lint
lint: ## Run linter
ruff check . --fix
.PHONY: build
build: build_3_10 build_3_11 build_3_12 build_3_13 ## Build all Python containers
.PHONY: build_3_10
build_3_10: ## Build Python 3.10 container
docker build --platform=linux/amd64 --build-arg GIT_REF=${GIT_REF} -t ${NAME}_py_3_10:${GIT_REF} -t ${NAME}_py_3_10:latest -f py3.10/Dockerfile .
.PHONY: build_3_11
build_3_11: ## Build Python 3.11 container
docker build --platform=linux/amd64 --build-arg GIT_REF=${GIT_REF} -t ${NAME}_py_3_11:${GIT_REF} -t ${NAME}_py_3_11:latest -f py3.11/Dockerfile .
.PHONY: build_3_12
build_3_12: ## Build Python 3.12 container
docker build --platform=linux/amd64 --build-arg GIT_REF=${GIT_REF} -t ${NAME}_py_3_12:${GIT_REF} -t ${NAME}_py_3_12:latest -f py3.12/Dockerfile .
.PHONY: build_3_13
build_3_13: ## Build Python 3.13 container
docker build --platform=linux/amd64 --build-arg GIT_REF=${GIT_REF} -t ${NAME}_py_3_13:${GIT_REF} -t ${NAME}_py_3_13:latest -f py3.13/Dockerfile .
.PHONY: build_shell
build_shell: ## Build Python 3.11 container
docker build --platform=linux/amd64 --build-arg GIT_REF=${GIT_REF} -t ${NAME}_shell:${GIT_REF} -t ${NAME}_shell:latest -f shell/Dockerfile .
.PHONY: test
test: test_predict test_3_10 test_3_11 test_3_12 test_3_13 ## Test all container versions
.PHONY: test_predict
test_predict: build_shell ## Test predict script
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_shell:latest python -m unittest tests.test_predict
.PHONY: test_3_10
test_3_10: build_3_10 ## Test Python 3.10 pickle
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_10:latest --model /tests/models/model_3_10_legacy.pkl
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_10:latest --model /tests/models/model_3_10.pkl
.PHONY: test_3_11
test_3_11: build_3_11 ## Test Python 3.11 pickle
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_11:latest --model /tests/models/model_3_11_legacy.pkl
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_11:latest --model /tests/models/model_3_11.pkl
.PHONY: test_3_12
test_3_12: build_3_12 ## Test Python 3.12 pickle
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_12:latest --model /tests/models/model_3_12_legacy.pkl
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_12:latest --model /tests/models/model_3_12.pkl
.PHONY: test_3_13
test_3_13: build_3_13 ## Test Python 3.13 pickle
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_13:latest --model /tests/models/model_3_13_legacy.pkl
docker run -i --rm -v ./tests/:/tests/ -v /tmp:/tmp ${NAME}_py_3_13:latest --model /tests/models/model_3_13.pkl
.PHONY: push_latest
push_latest: push_latest_3_10 push_latest_3_11 push_latest_3_12 push_latest_3_13 ## Push latest docker containers
.PHONY: push_latest_3_10
push_latest_3_10: build_3_10 ## Release Python 3.10 container tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_10:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_10:${GIT_REF}
docker tag ${NAME}_py_3_10:latest ${ECR_REPO}/${NAME}_py_3_10:latest
docker push ${ECR_REPO}/${NAME}_py_3_10:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_10:latest
.PHONY: push_latest_3_11
push_latest_3_11: build_3_11 ## Release Python 3.11 container tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_11:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_11:${GIT_REF}
docker tag ${NAME}_py_3_11:latest ${ECR_REPO}/${NAME}_py_3_11:latest
docker push ${ECR_REPO}/${NAME}_py_3_11:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_11:latest
.PHONY: push_latest_3_12
push_latest_3_12: build_3_12 ## Release Python 3.12 container tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_12:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_12:${GIT_REF}
docker tag ${NAME}_py_3_12:latest ${ECR_REPO}/${NAME}_py_3_12:latest
docker push ${ECR_REPO}/${NAME}_py_3_12:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_12:latest
.PHONY: push_latest_3_13
push_latest_3_13: build_3_13 ## Release Python 3.13 container tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_13:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_13:${GIT_REF}
docker tag ${NAME}_py_3_13:latest ${ECR_REPO}/${NAME}_py_3_13:latest
docker push ${ECR_REPO}/${NAME}_py_3_13:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_13:latest
.PHONY: push_latest_shell
push_latest_shell: build_shell ## Release Python 3.11 container tagged latest
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_shell:${GIT_REF} ${ECR_REPO}/${NAME}_shell:${GIT_REF}
docker tag ${NAME}_shell:latest ${ECR_REPO}/${NAME}_shell:latest
docker push ${ECR_REPO}/${NAME}_shell:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_shell:latest
.PHONY: push_stable
push_stable: push_stable_3_10 push_stable_3_11 push_stable_3_12 push_stable_3_13 ## Push all container tagged stable
.PHONY: push_stable_3_10
push_stable_3_10: build_3_10 ## Release Python 3.10 container tagged stable
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_10:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_10:${GIT_REF}
docker tag ${NAME}_py_3_10:latest ${ECR_REPO}/${NAME}_py_3_10:stable
docker push ${ECR_REPO}/${NAME}_py_3_10:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_10:stable
.PHONY: push_stable_3_11
push_stable_3_11: build_3_11## Release Python 3.11 container tagged stable
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_11:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_11:${GIT_REF}
docker tag ${NAME}_py_3_11:latest ${ECR_REPO}/${NAME}_py_3_11:stable
docker push ${ECR_REPO}/${NAME}_py_3_11:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_11:stable
.PHONY: push_stable_3_12
push_stable_3_12: build_3_12 ## Release Python 3.12 container tagged stable
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_12:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_12:${GIT_REF}
docker tag ${NAME}_py_3_12:latest ${ECR_REPO}/${NAME}_py_3_12:stable
docker push ${ECR_REPO}/${NAME}_py_3_12:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_12:stable
.PHONY: push_stable_3_13
push_stable_3_13: build_3_13 ## Release Python 3.13 container tagged stable
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin ${ECR_REPO}
docker tag ${NAME}_py_3_13:${GIT_REF} ${ECR_REPO}/${NAME}_py_3_13:${GIT_REF}
docker tag ${NAME}_py_3_13:latest ${ECR_REPO}/${NAME}_py_3_13:stable
docker push ${ECR_REPO}/${NAME}_py_3_13:${GIT_REF}
docker push ${ECR_REPO}/${NAME}_py_3_13:stable