Skip to content

Commit ac5150c

Browse files
committed
fix: don't double join path for dockerfile
All code paths up to here already join the context path and with the check above we're sure the file exists so joining again leads to paths that don't exist Signed-off-by: Dominik Süß <dominik@suess.wtf>
1 parent e8db551 commit ac5150c

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

podman_compose.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2917,7 +2917,7 @@ def cleanup_temp_dockfile() -> None:
29172917

29182918
if path_exists(dockerfile):
29192919
# normalize dockerfile path, as the user could have provided unpredictable file formats
2920-
dockerfile = os.path.normpath(os.path.join(ctx, dockerfile))
2920+
dockerfile = os.path.normpath(dockerfile)
29212921
build_args.extend(["-f", dockerfile])
29222922
else:
29232923
if custom_dockerfile_given:

tests/unit/test_container_to_build_args.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,23 @@ def test_build_ssh_array(self):
352352
'.',
353353
],
354354
)
355+
356+
def test_containerfile_in_context(self):
357+
c = create_compose_mock()
358+
359+
cnt = get_minimal_container()
360+
cnt['build']['context'] = "./subdir"
361+
args = get_minimal_args()
362+
args = container_to_build_args(c, cnt, args, lambda path: True)
363+
self.assertEqual(
364+
args,
365+
[
366+
'-f',
367+
'subdir/Containerfile',
368+
'-t',
369+
'new-image',
370+
'--no-cache',
371+
'--pull-always',
372+
'./subdir',
373+
],
374+
)

0 commit comments

Comments
 (0)