@@ -31,11 +31,11 @@ def dockerfile(self_module, input_params):
31
31
return {'return' : 1 , 'error' : 'No scripts were found' }
32
32
33
33
# Step 3: Process Dockerfile-related configurations
34
- environment_vars = input_params .get ('env' , {})
34
+ env = input_params .get ('env' , {})
35
35
state_data = input_params .get ('state' , {})
36
36
constant_vars = input_params .get ('const' , {})
37
37
constant_state = input_params .get ('const_state' , {})
38
- dockerfile_environment_vars = input_params .get ('dockerfile_env' , {})
38
+ dockerfile_env = input_params .get ('dockerfile_env' , {})
39
39
tag_values = input_params .get ('tags' , '' ).split ("," )
40
40
variation_tags = [tag [1 :] for tag in tag_values if tag .startswith ("_" )]
41
41
@@ -55,13 +55,13 @@ def dockerfile(self_module, input_params):
55
55
'script_variation_tags' : variation_tags
56
56
}
57
57
docker_settings = metadata .get ('docker' , {})
58
- docker_settings ['dockerfile_env' ] = dockerfile_environment_vars
58
+ docker_settings ['dockerfile_env' ] = dockerfile_env
59
59
state_data ['docker' ] = docker_settings
60
60
add_deps_recursive = input_params .get ('add_deps_recursive' , {})
61
61
62
62
# Update state with metadata and variations
63
63
update_state_result = self_module .update_state_from_meta (
64
- metadata , environment_vars , state_data , constant_vars , constant_state ,
64
+ metadata , env , state_data , constant_vars , constant_state ,
65
65
deps = [],
66
66
post_deps = [],
67
67
prehook_deps = [],
@@ -77,7 +77,7 @@ def dockerfile(self_module, input_params):
77
77
update_variations_result = self_module ._update_state_from_variations (
78
78
input_params , metadata , variation_tags , metadata .get (
79
79
'variations' , {}),
80
- environment_vars , state_data , constant_vars , constant_state ,
80
+ env , state_data , constant_vars , constant_state ,
81
81
deps = [], # Add your dependencies if needed
82
82
post_deps = [], # Add post dependencies if needed
83
83
prehook_deps = [], # Add prehook dependencies if needed
@@ -93,24 +93,39 @@ def dockerfile(self_module, input_params):
93
93
return update_variations_result
94
94
95
95
# Set Docker-specific configurations
96
- docker_settings = state_data . get ( 'docker' , {})
97
- docker_settings ['dockerfile_env' ] = dockerfile_environment_vars
98
- dockerfile_environment_vars ['MLC_RUN_STATE_DOCKER' ] = True
96
+ docker_settings = state_data [ 'docker' ]
97
+ docker_settings ['dockerfile_env' ] = dockerfile_env
98
+ dockerfile_env ['MLC_RUN_STATE_DOCKER' ] = True
99
99
100
100
if not docker_settings .get ('run' , True ) and not input_params .get (
101
101
'docker_run_override' , False ):
102
102
logging .info ("Docker 'run' is set to False in meta.json" )
103
103
continue
104
104
105
105
# Handle build dependencies
106
- build_dependencies = docker_settings .get ('build_deps' , [])
107
- if build_dependencies :
108
- deps_result = self_module ._run_deps (
109
- build_dependencies , run_state = run_state , verbose = input_params .get (
110
- 'v' , False )
111
- )
112
- if deps_result ['return' ] > 0 :
113
- return deps_result
106
+ show_time = input_params .get ('show_time' , False )
107
+ deps = docker_settings .get ('build_deps' , [])
108
+ if deps :
109
+ r = self_module ._run_deps (
110
+ deps , [], env , {}, {}, {}, {}, '' , [], '' , False , '' , verbose ,
111
+ show_time , ' ' , run_state )
112
+ if r ['return' ] > 0 :
113
+ return r
114
+
115
+ update_state_result = self_module .update_state_from_meta (
116
+ metadata , env , state_data , constant_vars , constant_state ,
117
+ deps = [],
118
+ post_deps = [],
119
+ prehook_deps = [],
120
+ posthook_deps = [],
121
+ new_env_keys = [],
122
+ new_state_keys = [],
123
+ run_state = run_state ,
124
+ i = input_params
125
+ )
126
+ if update_state_result ['return' ] > 0 :
127
+ return update_state_result
128
+ docker_settings = state_data ['docker' ]
114
129
115
130
# Prune temporary environment variables
116
131
run_command = copy .deepcopy (run_command_arc )
@@ -154,15 +169,15 @@ def dockerfile(self_module, input_params):
154
169
155
170
# Push Docker image if specified
156
171
if input_params .get ('docker_push_image' ) in [True , 'True' , 'yes' ]:
157
- environment_vars ['MLC_DOCKER_PUSH_IMAGE' ] = 'yes'
172
+ env ['MLC_DOCKER_PUSH_IMAGE' ] = 'yes'
158
173
159
174
# Generate Dockerfile
160
175
mlc_docker_input = {
161
176
'action' : 'run' , 'automation' : 'script' , 'tags' : 'build,dockerfile' ,
162
177
'fake_run_option' : " " if docker_inputs .get ('real_run' ) else " --fake_run" ,
163
178
'comments' : comments , 'run_cmd' : f"{ run_command_string } --quiet" ,
164
- 'script_tags' : input_params .get ('tags' ), 'env' : environment_vars ,
165
- 'dockerfile_env' : dockerfile_environment_vars ,
179
+ 'script_tags' : input_params .get ('tags' ), 'env' : env ,
180
+ 'dockerfile_env' : dockerfile_env ,
166
181
'quiet' : True , 'v' : input_params .get ('v' , False ), 'real_run' : True
167
182
}
168
183
mlc_docker_input .update (docker_inputs )
0 commit comments