@@ -194,7 +194,7 @@ def create_docker_compose():
194194 service .setdefault ("build" , {}).update (
195195 {
196196 "context" : path_to_root_from_compose_file ,
197- "dockerfile" : f" { container ["path" ]} /Dockerfile" ,
197+ "dockerfile" : container ["path" ][ "dockerfile" ] ,
198198 }
199199 )
200200 services [service_name ] = {
@@ -290,8 +290,6 @@ def add_lines(content: str):
290290
291291 for container_id , container in devcontainers .items ():
292292 container_before = self ._data_before .get (f"devcontainer_{ container_id } " , {})
293- dir_path = container ["path" ]
294- dir_path_before = container_before .get ("path" , dir_path )
295293 dockerfile = DynamicFile (
296294 type = DynamicFileType .DEVCONTAINER_DOCKERFILE ,
297295 subtype = (container_id , container ["container" ].get ("name" , container_id )),
@@ -304,10 +302,11 @@ def add_lines(content: str):
304302 )
305303 out .append (dockerfile )
306304 # devcontainer.json file
307- container_path = f"{ dir_path } /devcontainer.json"
305+ container_path = f"{ container [ "path" ][ "root" ] } /devcontainer.json"
308306 container ["container" ].setdefault ("dockerComposeFile" , []).append (
309307 _os .path .relpath (docker_compose_path , _os .path .dirname (container_path ))
310308 )
309+ dir_path_before = container_before .get ("path" , {}).get ("root" )
311310 container_file = DynamicFile (
312311 type = DynamicFileType .DEVCONTAINER_METADATA ,
313312 subtype = (container_id , container .get ("name" , container_id )),
@@ -317,7 +316,7 @@ def add_lines(content: str):
317316 ** self ._data ["default" ]["file_setting" ]["json" ],
318317 ),
319318 path = container_path ,
320- path_before = f"{ dir_path_before } /devcontainer.json" ,
319+ path_before = f"{ dir_path_before } /devcontainer.json" if dir_path_before else None ,
321320 )
322321 out .append (container_file )
323322 # apt.txt file
@@ -371,7 +370,7 @@ def add_lines(content: str):
371370 )
372371 for typ in tasks .keys ():
373372 task_file = DynamicFile (
374- type = DynamicFileType . DEVCONTAINER_TASK ,
373+ type = DynamicFileType [ f"DEVCONTAINER_TASK_ { typ . upper () } " ] ,
375374 subtype = (container_id , container .get ("name" , container_id )),
376375 content = _unit .create_dynamic_file (
377376 file_type = "txt" ,
0 commit comments