Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions automation/script/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def dockerfile(self_module, input_params):

# Prepare Docker-specific inputs
docker_inputs, dockerfile_path = prepare_docker_inputs(
input_params, docker_settings, script_directory)
input_params, docker_settings, script, False, self_module.action_object)

# Handle optional dependencies and comments
if input_params.get('print_deps'):
Expand Down Expand Up @@ -392,7 +392,7 @@ def docker_run(self_module, i):

# Prepare Docker-specific inputs
docker_inputs, dockerfile_path = prepare_docker_inputs(
i, docker_settings, script_path, True)
i, docker_settings, script, True, self_module.action_object)

if docker_inputs is None:
return {'return': 1, 'error': 'Error preparing Docker inputs'}
Expand Down
13 changes: 10 additions & 3 deletions automation/script/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,15 @@ def process_mounts(mounts, env, docker_settings, f_run_cmd, run_state):


def prepare_docker_inputs(input_params, docker_settings,
script_path, run_stage=False):
script, run_stage, mlc):
"""
Prepares Docker-specific inputs such as Dockerfile path and runtime options.

Args:
i: Input dictionary with user-specified overrides.
docker_settings: Docker-specific settings from the script's metadata.
script_path: Path to the script being executed.
script: Script being executed.
mlc: MLC action object

Returns:
Tuple with Docker inputs dictionary and Dockerfile path or None in case of an error.
Expand Down Expand Up @@ -171,7 +172,13 @@ def prepare_docker_inputs(input_params, docker_settings,
docker_base_image = docker_inputs.get('base_image')
docker_path = docker_inputs.get('path')
if not docker_path:
docker_path = script_path
script_meta = script.meta
script_uid = script_meta['uid']
script_alias = script_meta.get('alias')
folder_name = f"""{script_alias}_{script_uid[:5]}"""
docker_path = os.path.join(
mlc.repos_path, 'local', 'docker', folder_name)
# docker_path = os.getcwd()
docker_filename_suffix = (
docker_base_image.replace('/', '-').replace(':', '-')
if docker_base_image else f"{docker_inputs['os']}_{docker_inputs['os_version']}"
Expand Down
Loading