@@ -79,22 +79,13 @@ def build_docker_image(app_dir: str, app_name: str | None = None) -> str:
7979
8080 arch_suffix = detect_arch () # "arm64" or "amd64"
8181
82- # Prefer an arch-specific Dockerfile if provided (``ops/docker/Dockerfile.arm64``)
83- dockerfile_rel = (
84- f"ops/docker/Dockerfile.{ arch_suffix } "
85- if arch_suffix == "arm64"
86- else "ops/docker/Dockerfile"
87- )
88- dockerfile_path = os .path .join (app_dir , dockerfile_rel )
89-
90- if not os .path .exists (dockerfile_path ):
91- # Fall back to generic Dockerfile regardless of arch.
92- dockerfile_path = os .path .join (app_dir , "ops/docker/Dockerfile" )
82+ # Look for a Dockerfile at the top level of the app directory
83+ dockerfile_path = os .path .join (app_dir , "Dockerfile" )
9384
9485 if not os .path .exists (dockerfile_path ):
9586 raise FileNotFoundError (
9687 f"Expected Dockerfile not found at { dockerfile_path } . "
97- "Ensure your application provides the required build Dockerfile(s) ."
88+ "Ensure your application provides the required Dockerfile."
9889 )
9990
10091 image_tag = f"{ app_name } :latest-{ arch_suffix } "
@@ -123,7 +114,7 @@ def build_app(app_dir: str, app_name: str, force_rebuild: bool = False) -> bool:
123114
124115 console .print (f"[yellow]Building application: { app_name } ...[/yellow]" )
125116
126- binary_path = os .path .join (app_dir , "build- aarch64" , app_name )
117+ binary_path = os .path .join (app_dir , "build/ aarch64" , app_name )
127118
128119 # Skip if binary already exists unless a rebuild was requested
129120 if (not force_rebuild ) and os .path .exists (binary_path ):
@@ -156,9 +147,11 @@ def build_app(app_dir: str, app_name: str, force_rebuild: bool = False) -> bool:
156147 image_tag ,
157148 "/bin/bash" ,
158149 "-c" ,
159- "cd /home/workspace && if [ -f vcpkg.json ]; then "
150+ "cd /home/workspace && "
151+ "if [ -f vcpkg.json ]; then "
160152 "echo 'Installing dependencies from vcpkg.json...' && "
161- "${VCPKG_ROOT}/vcpkg install --triplet arm64-linux-dynamic-release; fi" ,
153+ '${VCPKG_ROOT}/vcpkg install --triplet arm64-linux-dynamic-release --x-install-root "$PWD/build/host/vcpkg_installed"; '
154+ "fi" ,
162155 ]
163156
164157 try :
@@ -188,14 +181,14 @@ def build_app(app_dir: str, app_name: str, force_rebuild: bool = False) -> bool:
188181 "else "
189182 "echo 'No CMake presets found, using manual configuration...' && "
190183 "export VCPKG_DEFAULT_TRIPLET=arm64-linux-dynamic-release && "
191- "cmake -B build- aarch64 -S . "
184+ "cmake -B build/ aarch64 -S . "
192185 "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake "
193186 "-DVCPKG_TARGET_TRIPLET=arm64-linux-dynamic-release "
194- "-DVCPKG_INSTALLED_DIR=${VCPKG_ROOT}/vcpkg_installed "
187+ "-DVCPKG_INSTALLED_DIR=${VCPKG_ROOT}/build/host/ vcpkg_installed "
195188 "-DBUILD_SHARED_LIBS=ON "
196189 "-DCMAKE_BUILD_TYPE=Release "
197190 "-DBUILD_FOR_ARM64=ON && "
198- "cmake --build build- aarch64 -j$(nproc); "
191+ "cmake --build build/ aarch64 -j$(nproc); "
199192 "fi"
200193 ),
201194 ]
@@ -255,7 +248,7 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
255248
256249 try :
257250 staging_dir = tempfile .mkdtemp (prefix = "synapse-package-" )
258- binary_path = os .path .join (app_dir , "build- aarch64" , app_name )
251+ binary_path = os .path .join (app_dir , "build/ aarch64" , app_name )
259252
260253 if not os .path .exists (binary_path ):
261254 console .print (
@@ -410,6 +403,9 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
410403 except ValueError :
411404 pass
412405
406+ dist_dir = os .path .join (app_dir , "dist" )
407+ os .makedirs (dist_dir , exist_ok = True )
408+
413409 docker_fpm_cmd = [
414410 "docker" ,
415411 "run" ,
@@ -419,7 +415,7 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
419415 "-v" ,
420416 f"{ staging_dir } :/pkg" ,
421417 "-v" ,
422- f"{ app_dir } :/out" ,
418+ f"{ dist_dir } :/out" ,
423419 "-w" ,
424420 "/out" ,
425421 fpm_image ,
@@ -436,11 +432,11 @@ def build_deb_package(app_dir: str, app_name: str, version: str = "0.1.0") -> bo
436432
437433 # Verify that a .deb was produced
438434 deb_files = [
439- f for f in os .listdir (app_dir ) if f .endswith (".deb" ) and "arm64" in f
435+ f for f in os .listdir (dist_dir ) if f .endswith (".deb" ) and "arm64" in f
440436 ]
441437 if not deb_files :
442438 console .print (
443- f"[bold red]Error:[/bold red] FPM completed but no .deb found in { app_dir } ."
439+ f"[bold red]Error:[/bold red] FPM completed but no .deb found in { dist_dir } ."
444440 )
445441 return False
446442
@@ -463,14 +459,14 @@ def package_app(app_dir: str, app_name: str) -> bool:
463459 return build_deb_package (app_dir , app_name )
464460
465461
466- def find_deb_package (app_dir : str ) -> str | None :
462+ def find_deb_package (dist_dir : str ) -> str | None :
467463 """Return the path to the .deb generated in *app_dir* or *None*."""
468- for file in os .listdir (app_dir ):
464+ for file in os .listdir (dist_dir ):
469465 if file .endswith (".deb" ):
470- return os .path .join (app_dir , file )
466+ return os .path .join (dist_dir , file )
471467
472468 console .print (
473- f"[bold red]Error:[/bold red] Could not find .deb package in { app_dir } "
469+ f"[bold red]Error:[/bold red] Could not find .deb package in { dist_dir } "
474470 )
475471 return None
476472
@@ -507,7 +503,7 @@ def build_cmd(args) -> None:
507503 return
508504
509505 # 3. Locate artefact and present summary panel
510- deb_path = find_deb_package (app_dir )
506+ deb_path = find_deb_package (os . path . join ( app_dir , "dist" ) )
511507 if not deb_path :
512508 return
513509
0 commit comments