Skip to content
Snippets Groups Projects
Commit 7496aea7 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

Use buildx to compile when installed

parent 73e4d97e
No related branches found
No related tags found
2 merge requests!204📝 Adjust source_control section, mercurial is not needed directly,!203✨ Replace docker-py by python_on_whales
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
https://github.com/docker/docker-py/issues/2230 https://github.com/docker/docker-py/issues/2230
If buildx for docker is installed, use it to build.
20.14.0 20.14.0
------- -------
......
...@@ -242,13 +242,23 @@ ...@@ -242,13 +242,23 @@
_logger.debug("Docker Pull %s", pull) _logger.debug("Docker Pull %s", pull)
full_tags = [repository] if nmspc.local else [f"{repository}:{tag}" for tag in tags] full_tags = [repository] if nmspc.local else [f"{repository}:{tag}" for tag in tags]
with capture_docker_exit_code() as exit_code: with capture_docker_exit_code() as exit_code:
docker.image.build( if docker.buildx.is_installed():
context_path=".", _logger.info("Starting build with buildx")
pull=pull, docker.buildx.build(
build_args=buildargs, context_path=".",
tags=full_tags, pull=pull,
file=dockerfile, 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: if dev:
call(["rm", dockerfile]) call(["rm", dockerfile])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment