/
build-docker.py
36 lines (30 loc) · 1003 Bytes
/
build-docker.py
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
import os
import sys
def execute_command(cmd):
status = os.system(cmd)
ec = os.WEXITSTATUS(status)
if ec != 0:
raise SystemExit('Command "{}" failed'.format(cmd))
if sys.platform.startswith("linux"):
execute_command("git rev-parse HEAD > git-rev")
execute_command(
"(cd ../.. && git archive -o ci/teamcity/modin.tar $(cat ci/teamcity/git-rev))"
)
base_image = "ray-project/deploy"
requirements = "requirements.txt"
execute_command(
"docker build -f Dockerfile.modin-base --build-arg BASE_IMAGE={} -t modin-project/modin-base .".format(
base_image
)
)
else:
raise SystemExit(
"TeamCity CI in Docker containers is supported only on Linux at the moment."
)
execute_command(
"docker build -f Dockerfile.teamcity-ci --build-arg REQUIREMENTS={} -t modin-project/teamcity-ci .".format(
requirements
)
)
if sys.platform.startswith("linux"):
execute_command("rm ./modin.tar ./git-rev")