-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.py
49 lines (35 loc) · 1.46 KB
/
build.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
37
38
39
40
41
42
43
44
45
46
47
48
49
import os
from argparse import ArgumentParser
from universal_build import build_utils
from universal_build.helpers import build_docker, build_python, openapi_utils
HERE = os.path.abspath(os.path.dirname(__file__))
WEBAPP_COMPONENT = "webapp"
PYTHON_LIB_COMPONENT = "backend"
COMPONENT_NAME = "insert-component-name-here"
def main(args: dict) -> None:
"""Execute all component builds."""
# set script path as working dir
os.chdir(HERE)
version = args.get(build_utils.FLAG_VERSION)
# Build python lib
build_utils.build(PYTHON_LIB_COMPONENT, args)
if args.get(build_utils.FLAG_MAKE):
build_utils.build(WEBAPP_COMPONENT, args)
build_docker.build_docker_image(COMPONENT_NAME, version, exit_on_error=True)
# TODO: Uncomment when dockerfile is finalized
# if args.get(build_utils.FLAG_CHECK):
# build_docker.lint_dockerfile(exit_on_error=True)
# Only allow releasing from sub components when force flag is set as an extra precaution step
if args.get(build_utils.FLAG_RELEASE) and args.get(build_utils.FLAG_FORCE):
build_docker.release_docker_image(
COMPONENT_NAME,
args[build_utils.FLAG_VERSION],
"ghcr.io/sap/machine-learning-lab",
)
if __name__ == "__main__":
parser = ArgumentParser()
parser.add_argument(
f"--contaxy-version", help="Version of the contaxy library to use."
)
args = build_utils.parse_arguments(argument_parser=parser)
main(args)