in wadebug/wa_actions/docker_utils.py [0:0]
def put_archive_to_container(container, src, dest):
with tempfile.NamedTemporaryFile() as temptar: # tempfile backed tarfile
file_data = open(src, "rb").read()
tar_file = tarfile.open(fileobj=temptar, mode="w")
tarinfo = tarfile.TarInfo(name=os.path.basename(src))
tarinfo.size = os.stat(src).st_size
tar_file.addfile(tarinfo, BytesIO(file_data))
tar_file.close()
temptar.flush()
temptar.seek(0)
container.put_archive(dest, temptar.read())