Skip to content

Commit 16a68b5

Browse files
committed
Merge docker env changes
1 parent a333cae commit 16a68b5

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

automation/script/docker.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,15 +429,19 @@ def docker_run(self_module, i):
429429
return r
430430
final_run_cmd = f"""{r['run_cmd_string']} {container_env_string} --docker_run_deps """
431431

432+
432433
# Execute the Docker container
433434
mlc_docker_input = {
434435
'action': 'run', 'target': 'script', 'tags': 'run,docker,container',
435436
'rebuild': rebuild_docker_image,
436437
'env': env, 'mounts': mounts,
437438
'script_tags': i.get('tags'), 'run_cmd': final_run_cmd,
438-
'quiet': True, 'real_run': True, 'add_deps_recursive': {'build-docker-image': {'dockerfile': dockerfile_path}},
439-
**docker_inputs
439+
'quiet': True, 'real_run': True, 'add_deps_recursive': {'build-docker-image': {'dockerfile': dockerfile_path}}
440440
}
441+
utils.merge_dicts({'dict1': mlc_docker_input,
442+
'dict2': docker_inputs,
443+
'append_lists': True,
444+
'append_unique': True})
441445

442446
r = self_module.action_object.access(mlc_docker_input)
443447
if r['return'] > 0:

script/build-docker-image/customize.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ def preprocess(i):
2121

2222
MLC_DOCKER_BUILD_ARGS = env.get('+ MLC_DOCKER_BUILD_ARGS', [])
2323

24+
25+
if not is_false(env.get('MLC_DOCKER_USE_HOST_USER_ID')) and os.name != 'nt' and "UID=\" $(id -u $USER) \"" not in MLC_DOCKER_BUILD_ARGS:
26+
MLC_DOCKER_BUILD_ARGS.append(f"UID=\" $(id -u $USER) \"")
27+
if not is_false(env.get('MLC_DOCKER_USE_HOST_GROUP_ID')) and os.name != 'nt' and "GID=\" $(id -g $USER) \"" not in MLC_DOCKER_BUILD_ARGS:
28+
MLC_DOCKER_BUILD_ARGS.append(f"GID=\" $(id -g $USER) \"")
29+
2430
if env.get('MLC_GH_TOKEN', '') != '':
2531
MLC_DOCKER_BUILD_ARGS.append("MLC_GH_TOKEN=" + env['MLC_GH_TOKEN'])
2632

script/run-docker-container/meta.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ input_mapping:
4545
interactive: MLC_DOCKER_INTERACTIVE_MODE
4646
it: MLC_DOCKER_INTERACTIVE
4747
mounts: MLC_DOCKER_VOLUME_MOUNTS
48+
use_host_user_id: MLC_DOCKER_USE_HOST_USER_ID
49+
use_host_group_id: MLC_DOCKER_USE_HOST_GROUP_ID
4850
pass_user_id: MLC_DOCKER_PASS_USER_ID
4951
pass_user_group: MLC_DOCKER_PASS_USER_GROUP
5052
port_maps: MLC_DOCKER_PORT_MAPS

0 commit comments

Comments
 (0)