Skip to content

Commit b6fa2d4

Browse files
committed
Simulate json output from docker buildx build
We still use the docker python api to push images, and to run. So we need to set string_output to false, and simulate the json output on buildx. Alternatively we could completely get rid of the python API, but that's a much bigger lift (especially around registry credentials) that I don't want us to do right now. Without this, push progress is reported as raw bytes in the binderhub UI
1 parent b243cb6 commit b6fa2d4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

repo2docker/docker.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class DockerEngine(ContainerEngine):
5858
https://docker-py.readthedocs.io/en/4.2.0/api.html#module-docker.api.build
5959
"""
6060

61-
string_output = True
61+
string_output = False
6262

6363
extra_init_args = Dict(
6464
{},
@@ -141,12 +141,18 @@ def build(
141141

142142
args += [d]
143143

144-
yield from execute_cmd(args, True)
144+
for line in execute_cmd(args, True):
145+
# Simulate structured JSON output from buildx build, since we
146+
# do get structured json output from pushing and running
147+
yield {"stream": line}
145148
else:
146149
# Assume 'path' is passed in
147150
args += [path]
148151

149-
yield from execute_cmd(args, True)
152+
for line in execute_cmd(args, True):
153+
# Simulate structured JSON output from buildx build, since we
154+
# do get structured json output from pushing and running
155+
yield {"stream": line}
150156

151157
def images(self):
152158
images = self._apiclient.images()

0 commit comments

Comments
 (0)