File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 11FROM quay.io/deis/base:v0.3.5
22
3- RUN buildDeps='gcc git libffi-dev libssl-dev python -dev python -pip python -wheel python -setuptools' ; \
3+ RUN buildDeps='gcc git libffi-dev libssl-dev python3 -dev python3 -pip python3 -wheel python3 -setuptools' ; \
44 apt-get update && \
55 apt-get install -y --no-install-recommends \
66 $buildDeps \
77 libffi6 \
88 libssl1.0.0 \
9- python && \
10- pip install --disable-pip-version-check --no-cache-dir docker-py==1.10.6 && \
9+ python3-minimal && \
10+ pip3 install --disable-pip-version-check --no-cache-dir docker-py==1.10.6 && \
1111 # cleanup
1212 apt-get purge -y --auto-remove $buildDeps && \
1313 apt-get autoremove -y && \
@@ -35,4 +35,4 @@ RUN chmod +x /bin/objstorage
3535
3636COPY . /
3737
38- CMD ["python " , "/deploy.py" ]
38+ CMD ["python3 " , "/deploy.py" ]
Original file line number Diff line number Diff line change 11import docker
22import os
3+ import sys
34import tarfile
45import time
56import requests
1213def log_output (stream , decode ):
1314 error = False
1415 for chunk in stream :
16+ if isinstance (chunk , bytes ):
17+ # Convert to dict, since docker-py returns some errors as raw bytes.
18+ chunk = eval (chunk )
1519 if 'error' in chunk :
1620 error = True
17- if isinstance (chunk , basestring ): # Change "basestring" to "str" for Python3
18- print (chunk .decode ('utf-8' ))
19- else :
20- print (chunk ['error' ].decode ('utf-8' ))
21+ print (chunk ['error' ])
2122 elif decode :
2223 stream_chunk = chunk .get ('stream' )
2324 if stream_chunk :
24- stream_chunk = stream_chunk .encode ('utf-8' ).strip ()
25- print (stream_chunk .replace ('\n ' , '' ))
25+ # Must handle chunks as bytes to avoid UnicodeEncodeError.
26+ encoded_chunk = stream_chunk .encode ('utf-8' )
27+ sys .stdout .buffer .write (encoded_chunk )
2628 elif DEBUG :
27- print (chunk .decode ('utf-8' ))
29+ print (chunk )
30+ sys .stdout .flush ()
2831 if error :
2932 # HACK: delay so stderr is logged before this dockerbuilder pod exits.
3033 time .sleep (3 )
You can’t perform that action at this time.
0 commit comments