diff --git a/NEWS.rst b/NEWS.rst index 73e4d97e8d2312501020b8b5cc4e84c0fef4c852_TkVXUy5yc3Q=..7496aea73410b18340ff558f44d4de92fa6d71b0_TkVXUy5yc3Q= 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -9,6 +9,8 @@ https://github.com/docker/docker-py/issues/2230 +If buildx for docker is installed, use it to build. + 20.14.0 ------- diff --git a/odoo_scripts/docker_build.py b/odoo_scripts/docker_build.py index 73e4d97e8d2312501020b8b5cc4e84c0fef4c852_b2Rvb19zY3JpcHRzL2RvY2tlcl9idWlsZC5weQ==..7496aea73410b18340ff558f44d4de92fa6d71b0_b2Rvb19zY3JpcHRzL2RvY2tlcl9idWlsZC5weQ== 100644 --- a/odoo_scripts/docker_build.py +++ b/odoo_scripts/docker_build.py @@ -242,13 +242,23 @@ _logger.debug("Docker Pull %s", pull) full_tags = [repository] if nmspc.local else [f"{repository}:{tag}" for tag in tags] with capture_docker_exit_code() as exit_code: - docker.image.build( - context_path=".", - pull=pull, - build_args=buildargs, - tags=full_tags, - file=dockerfile, - ) + if docker.buildx.is_installed(): + _logger.info("Starting build with buildx") + docker.buildx.build( + context_path=".", + pull=pull, + build_args=buildargs, + tags=full_tags, + file=dockerfile, + ) + else: + docker.image.build( + context_path=".", + pull=pull, + build_args=buildargs, + tags=full_tags, + file=dockerfile, + ) if dev: call(["rm", dockerfile])