fix: add --network=host to docker and fix build tool fallback order
Pass --network=host to docker build and docker create so package builds can reach the network. Reorder auto-detection so Docker is tried before buildah/native, only falling back when the explicit flag is not set.
This commit is contained in:
+8
-2
@@ -769,6 +769,7 @@ def build_package_docker(
|
||||
build_args = [
|
||||
'docker', 'build',
|
||||
'--pull',
|
||||
'--network=host',
|
||||
'-f', str(central_dockerfile),
|
||||
'--build-arg', f'BASE_IMAGE={base_image}',
|
||||
'--build-arg', f'PACKAGE_NAME={package_name}',
|
||||
@@ -801,6 +802,7 @@ def build_package_docker(
|
||||
# Step 2: Create and start container
|
||||
create_args = [
|
||||
'docker', 'create',
|
||||
'--network=host',
|
||||
'--name', container_name,
|
||||
image_name
|
||||
]
|
||||
@@ -1455,9 +1457,13 @@ class Builder:
|
||||
return True
|
||||
|
||||
# Check build tool availability (unless dry run)
|
||||
use_native = native or (not buildah and check_native_build_deps())
|
||||
use_buildah = buildah or (not use_native and check_buildah_available())
|
||||
use_native = native
|
||||
use_buildah = buildah
|
||||
use_docker = not use_native and not use_buildah and check_docker_available()
|
||||
if not use_native and not use_buildah and not use_docker:
|
||||
use_buildah = check_buildah_available()
|
||||
if not use_native and not use_buildah and not use_docker:
|
||||
use_native = check_native_build_deps()
|
||||
|
||||
if not dry_run and not use_native and not use_buildah and not use_docker:
|
||||
self.logger.error("No build tools available (tried native, Buildah, Docker)")
|
||||
|
||||
Reference in New Issue
Block a user