mirror of
https://github.com/docker/docs.git
synced 2026-04-05 18:58:55 +07:00
detect compressed archives in API /build call
AFAIK in some previous version it was possible to give a compressed docker file to the API's build command and that was handled properly (aka compression was detected and archive uncompressed accordingly). Fails with at least 0.7.5. Fixed this using the DecompressStream method from the archive package. Docker-DCO-1.1-Signed-off-by: Gereon Frey <me@gereonfrey.de> (github: gfrey)
This commit is contained in:
@@ -630,7 +630,13 @@ func (b *buildFile) Build(context io.Reader) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
b.context = &utils.TarSum{Reader: context, DisableCompression: true}
|
||||
|
||||
decompressedStream, err := archive.DecompressStream(context)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
b.context = &utils.TarSum{Reader: decompressedStream, DisableCompression: true}
|
||||
if err := archive.Untar(b.context, tmpdirPath, nil); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user