@@ -97,18 +97,17 @@ def _write_docker_compose(output_path):
9797 "services:" ,
9898 ]
9999
100- prev_service_name = None
101100 named_volumes = set ()
102101 for index , service in enumerate (services , start = 1 ):
103102 service_name = re .sub (r"[^A-Za-z0-9_.-]" , "-" , service ["container_name" ]).strip (
104103 "-."
105104 )
106105 if not service_name :
107106 service_name = f"service-{ index } "
108- elif not service_name [0 ].isalnum ():
107+ elif not service_name [0 ].isalpha ():
109108 service_name = f"service-{ service_name } "
110109
111- compose_lines .append (f" { service_name } :" )
110+ compose_lines .append (f" { _yaml_quote ( service_name ) } :" )
112111 compose_lines .append (f" image: { _yaml_quote (service ['image' ])} " )
113112 compose_lines .append (
114113 f" container_name: { _yaml_quote (service ['container_name' ])} "
@@ -117,11 +116,6 @@ def _write_docker_compose(output_path):
117116 compose_lines .append (" networks:" )
118117 compose_lines .append (" - concore-net" )
119118
120- # Chain services sequentially to prevent ZMQ race conditions
121- if prev_service_name :
122- compose_lines .append (" depends_on:" )
123- compose_lines .append (f" - { prev_service_name } " )
124-
125119 if service ["volumes" ]:
126120 compose_lines .append (" volumes:" )
127121 for volume_spec in service ["volumes" ]:
@@ -130,7 +124,6 @@ def _write_docker_compose(output_path):
130124 if re .match (r"^[a-zA-Z0-9_-]+$" , part1 ):
131125 named_volumes .add (part1 )
132126
133- prev_service_name = service_name
134127
135128 if named_volumes :
136129 compose_lines .append ("" )
@@ -219,22 +212,24 @@ def build_workflow(
219212 elif (output_path / "src" ).exists ():
220213 req_dest .touch ()
221214
222- # Append requirement copying to generated scripts
215+ # Append requirement copying to generated scripts robustly
223216 for s_name in ["build" , "build.bat" ]:
224217 s_path = output_path / s_name
225218 if s_path .exists ():
226219 content = s_path .read_text (encoding = "utf-8" )
220+ lines = content .splitlines ()
227221 if s_name == "build" :
228- content = content .replace (
229- "docker build" ,
230- "cp ../src/requirements.txt .\n docker build" ,
231- )
222+ insert_line = "cp ../src/requirements.txt ."
232223 else :
233- content = content .replace (
234- "docker build" ,
235- "copy ..\\ src\\ requirements.txt .\n docker build" ,
236- )
237- s_path .write_text (content , encoding = "utf-8" )
224+ insert_line = "copy ..\\ src\\ requirements.txt ."
225+
226+ new_lines = []
227+ for line in lines :
228+ if " build" in line and "-t " in line :
229+ new_lines .append (insert_line )
230+ new_lines .append (line )
231+
232+ s_path .write_text ("\n " .join (new_lines ) + "\n " , encoding = "utf-8" )
238233
239234 if result .stdout :
240235 console .print (result .stdout )
0 commit comments