mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2026-02-03 04:09:29 -05:00
fix: Compress build context before sending it to Docker (#461)
This fixes #439 by gzipping the build context, which prevents the Docker API from misinterpreting the stream as a plain text Dockerfile. Co-authored-by: Martin <Junkern@users.noreply.github.com>
This commit is contained in:
parent
7e1842ccd6
commit
ae80eb7d7b
1 changed files with 9 additions and 0 deletions
|
|
@ -410,6 +410,15 @@ func prepareBuildContext(specifiedContext string, specifiedDockerfile string) (i
|
|||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
}
|
||||
// Compress build context to avoid Docker misinterpreting it as plain text
|
||||
if buildCtx != nil {
|
||||
buildCtx, err = build.Compress(buildCtx)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
}
|
||||
}
|
||||
if relDockerfile != "" {
|
||||
return buildCtx, relDockerfile, nil
|
||||
}
|
||||
return buildCtx, specifiedDockerfile, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue