Skip to content

Commit

Permalink
add --load flag (#9)
Browse files Browse the repository at this point in the history
* add --load flag

* Update test with --load flag
  • Loading branch information
Julien-Ben authored Nov 17, 2023
1 parent 0c21097 commit 7dce8ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sonar/builders/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_docker_build_cli_args(
labels=Optional[Dict[str, str]],
platform=Optional[str]
):
args = ["docker", "buildx", "build", "--progress", "plain", path, "-f", dockerfile, "-t", tag]
args = ["docker", "buildx", "build", "--load" , "--progress", "plain", path, "-f", dockerfile, "-t", tag]
if buildargs is not None:
for k, v in buildargs.items():
args.append("--build-arg")
Expand Down
4 changes: 2 additions & 2 deletions test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,6 @@ def test_platform_is_passed_to_docker_build(_docker_build, _docker_tag):


def test_get_docker_build_cli_args():
assert "docker buildx build --progress plain . -f dockerfile -t image:latest" == " ".join(get_docker_build_cli_args(".", "dockerfile", "image:latest", None, None, None))
assert "docker buildx build --progress plain . -f dockerfile -t image:latest --build-arg a=1 --build-arg long_arg=long_value --label l1=v1 --label l2=v2 --platform linux/amd64" == " ".join(
assert "docker buildx build --load --progress plain . -f dockerfile -t image:latest" == " ".join(get_docker_build_cli_args(".", "dockerfile", "image:latest", None, None, None))
assert "docker buildx build --load --progress plain . -f dockerfile -t image:latest --build-arg a=1 --build-arg long_arg=long_value --label l1=v1 --label l2=v2 --platform linux/amd64" == " ".join(
get_docker_build_cli_args(".", "dockerfile", "image:latest", {"a": "1", "long_arg": "long_value"}, {"l1": "v1", "l2": "v2"}, "linux/amd64"))

0 comments on commit 7dce8ab

Please sign in to comment.