mirror of https://github.com/docker/docker-py.git
Add an option to gzip tar files.
This can be used to make building much faster. Signed-off-by: speedplane <mes65@cornell.edu>
This commit is contained in:
parent
4c34be5d4a
commit
4529dceaaf
|
@ -91,10 +91,10 @@ def decode_json_header(header):
|
|||
return json.loads(data)
|
||||
|
||||
|
||||
def tar(path, exclude=None, dockerfile=None, fileobj=None):
|
||||
def tar(path, exclude=None, dockerfile=None, fileobj=None, gzip=False):
|
||||
if not fileobj:
|
||||
fileobj = tempfile.NamedTemporaryFile()
|
||||
t = tarfile.open(mode='w', fileobj=fileobj)
|
||||
t = tarfile.open(mode='w:gz' if gzip else 'w', fileobj=fileobj)
|
||||
|
||||
root = os.path.abspath(path)
|
||||
exclude = exclude or []
|
||||
|
|
Loading…
Reference in New Issue