Kaydet (Commit) 76845602 authored tarafından Batuhan Taşkaya's avatar Batuhan Taşkaya

Path-like support for dockerfile directory

Fixes #2336
Signed-off-by: 's avatarBatuhan Taşkaya <btaskaya33@gmail.com>
üst 23c5c001
......@@ -124,6 +124,8 @@ class BuildApiMixin(object):
buildargs = buildargs or {}
if path is None and fileobj is None:
raise TypeError("Either path or fileobj needs to be provided.")
if path is not None:
path = os.fspath(path)
if gzip and encoding is not None:
raise errors.DockerException(
'Can not use custom encoding if gzip is enabled'
......
import gzip
import io
import shutil
from pathlib import Path
import docker
from docker import auth
......@@ -99,6 +100,9 @@ class BuildTest(BaseAPIClientTest):
def test_build_container_with_named_dockerfile(self):
self.client.build('.', dockerfile='nameddockerfile')
def test_build_container_with_pathlike(self):
self.client.build(Path('.'))
def test_build_container_with_container_limits(self):
self.client.build('.', container_limits={
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment