Skip to content

Commit 8002222

Browse files
authored
Merge pull request #2553 from fengbaolong/fix-unicode-in-dockerfile
fix docker build error when dockerfile contains unicode character.
2 parents 8c893dd + a07b5ee commit 8002222

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docker/utils/build.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ def create_archive(root, files=None, fileobj=None, gzip=False,
105105

106106
for name, contents in extra_files:
107107
info = tarfile.TarInfo(name)
108-
info.size = len(contents)
109-
t.addfile(info, io.BytesIO(contents.encode('utf-8')))
108+
contents_encoded = contents.encode('utf-8')
109+
info.size = len(contents_encoded)
110+
t.addfile(info, io.BytesIO(contents_encoded))
110111

111112
t.close()
112113
fileobj.seek(0)

0 commit comments

Comments
 (0)