Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ctfcli/core/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def __init__(self, name: str, build_path: Optional[Union[str, PathLike]] = None)
self.built = False

def build(self) -> Optional[str]:
docker_build = subprocess.call(["docker", "build", "-t", self.name, "."], cwd=self.build_path.absolute())
docker_build = subprocess.call(
["docker", "build", "--load", "-t", self.name, "."], cwd=self.build_path.absolute()
)
if docker_build != 0:
return

Expand Down
12 changes: 8 additions & 4 deletions tests/core/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def test_build(self, mock_call: MagicMock):

self.assertTrue(image.built)
self.assertEqual(image_name, "test-challenge")
mock_call.assert_called_once_with(["docker", "build", "-t", "test-challenge", "."], cwd=build_path.absolute())
mock_call.assert_called_once_with(
["docker", "build", "--load", "-t", "test-challenge", "."], cwd=build_path.absolute()
)

@mock.patch("ctfcli.core.image.subprocess.call", return_value=1)
def test_build_returns_none_if_failed(self, mock_call: MagicMock):
Expand All @@ -68,7 +70,9 @@ def test_build_returns_none_if_failed(self, mock_call: MagicMock):

self.assertFalse(image.built)
self.assertIsNone(image_name)
mock_call.assert_called_once_with(["docker", "build", "-t", "test-challenge", "."], cwd=build_path.absolute())
mock_call.assert_called_once_with(
["docker", "build", "--load", "-t", "test-challenge", "."], cwd=build_path.absolute()
)

@mock.patch("ctfcli.core.image.subprocess.call", return_value=0)
def test_push_built_image(self, mock_call: MagicMock):
Expand Down Expand Up @@ -150,7 +154,7 @@ def test_builds_image_before_push(self, mock_call: MagicMock):
mock_call.assert_has_calls(
[
call(
["docker", "build", "-t", "test-challenge", "."],
["docker", "build", "--load", "-t", "test-challenge", "."],
cwd=build_path.absolute(),
),
call(
Expand Down Expand Up @@ -224,7 +228,7 @@ def test_builds_image_before_export(self, mock_call: MagicMock):
mock_call.assert_has_calls(
[
call(
["docker", "build", "-t", "test-challenge", "."],
["docker", "build", "--load", "-t", "test-challenge", "."],
cwd=build_path.absolute(),
),
call(
Expand Down