Handle JSON stream responses from buildImage

determine whether response from docker.buildImage is JSON and if so pipe it through JSONStream.parse

This allows the response stream to be rendered appropriately if a newer version of Docker is used which returns a JSONStream instead of plain text.

In an ideal world, dockerode would be aware and dealing with this, but in its current state it doesn't even have any awareness of different API versions altogether. So we do detection based on the content-type of the response which works here if not everywhere.

The code could be written in a slightly more adventurous form as follows:

```
        if res.headers["content-type"] == "application/json"
          res = res.pipe(JSONStream.parse 'stream')

        res.pipe(process.stdout)
```

which would do avoid some code duplication, but I opted for the clearer form.