78
78
ECR_AWS_PROFILE : str = os .getenv ("ECR_READ_AWS_PROFILE" , "default" ) # type: ignore
79
79
GIT_TAG : str = os .getenv ("GIT_TAG" ) # type: ignore
80
80
ENV : str = os .getenv ("DD_ENV" ) # type: ignore
81
+ WORKSPACE_PATH = os .getenv ("WORKSPACE" , "." )
81
82
82
83
INITIAL_K8S_CACHE_TTL_SECONDS : int = 60
83
84
MAX_IMAGE_TAG_LEN = 128
@@ -494,15 +495,14 @@ def get_base_image_params(
494
495
495
496
# The context should be whatever WORKDIR is in the container running the build app itself.
496
497
inference_folder = "model-engine/model_engine_server/inference"
497
- base_path : str = os .getenv ("WORKSPACE" ) # type: ignore
498
498
499
499
logger_adapter .info (f"inference_folder: { inference_folder } " )
500
500
logger_adapter .info (f"dockerfile: { inference_folder } /{ dockerfile } " )
501
501
return BuildImageRequest (
502
502
repo = hmi_config .user_inference_base_repository ,
503
503
image_tag = resulting_image_tag [:MAX_IMAGE_TAG_LEN ],
504
504
aws_profile = ECR_AWS_PROFILE , # type: ignore
505
- base_path = base_path ,
505
+ base_path = WORKSPACE_PATH ,
506
506
dockerfile = f"{ inference_folder } /{ dockerfile } " ,
507
507
base_image = base_image ,
508
508
requirements_folder = None ,
@@ -557,9 +557,7 @@ def _get_user_image_params(
557
557
558
558
# The context should be whatever WORKDIR is in the container running the build app itself.
559
559
inference_folder = "model-engine/model_engine_server/inference"
560
- base_path : str = os .getenv ("WORKSPACE" ) # type: ignore
561
-
562
- requirements_folder = os .path .join (base_path , f"requirements_{ requirements_hash } " )
560
+ requirements_folder = os .path .join (WORKSPACE_PATH , f"requirements_{ requirements_hash } " )
563
561
try :
564
562
os .mkdir (requirements_folder )
565
563
except FileExistsError :
@@ -577,7 +575,7 @@ def _get_user_image_params(
577
575
repo = ecr_repo ,
578
576
image_tag = service_image_tag [:MAX_IMAGE_TAG_LEN ],
579
577
aws_profile = ECR_AWS_PROFILE ,
580
- base_path = base_path ,
578
+ base_path = WORKSPACE_PATH ,
581
579
dockerfile = f"{ inference_folder } /{ dockerfile } " ,
582
580
base_image = base_image ,
583
581
requirements_folder = requirements_folder ,
@@ -609,9 +607,7 @@ def _get_inject_bundle_image_params(
609
607
# The context should be whatever WORKDIR is in the container running the build app itself.
610
608
dockerfile = "inject_bundle.Dockerfile"
611
609
inference_folder = "model-engine/model_engine_server/inference"
612
- base_path : str = os .getenv ("WORKSPACE" ) # type: ignore
613
-
614
- bundle_folder = os .path .join (base_path , f"bundle_{ service_image_hash } " )
610
+ bundle_folder = os .path .join (WORKSPACE_PATH , f"bundle_{ service_image_hash } " )
615
611
try :
616
612
os .mkdir (bundle_folder )
617
613
except FileExistsError :
@@ -635,7 +631,7 @@ def _get_inject_bundle_image_params(
635
631
repo = ecr_repo ,
636
632
image_tag = service_image_tag [:MAX_IMAGE_TAG_LEN ],
637
633
aws_profile = ECR_AWS_PROFILE ,
638
- base_path = base_path ,
634
+ base_path = WORKSPACE_PATH ,
639
635
dockerfile = f"{ inference_folder } /{ dockerfile } " ,
640
636
base_image = base_image ,
641
637
requirements_folder = bundle_folder ,
0 commit comments