mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-20 22:59:42 -05:00
fix: rewriting tar header fields (#198)
closes #192 Co-authored-by: DL <david.laburthe@external.terega.fr>
This commit is contained in:
parent
6c796e15a5
commit
588c621617
1 changed files with 11 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ import (
|
|||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
|
|
@ -297,6 +298,16 @@ func buildDockerImageContextTar(buildContext string) (string, error) {
|
|||
// update the name to correctly reflect the desired destination when untaring
|
||||
header.Name = strings.TrimPrefix(strings.Replace(file, buildContext, "", -1), string(filepath.Separator))
|
||||
|
||||
// set archive metadata non deterministic
|
||||
header.Mode = 0
|
||||
header.Uid = 0
|
||||
header.Gid = 0
|
||||
header.Uname = ""
|
||||
header.Gname = ""
|
||||
header.ModTime = time.Time{}
|
||||
header.AccessTime = time.Time{}
|
||||
header.ChangeTime = time.Time{}
|
||||
|
||||
// write the header
|
||||
if err := tw.WriteHeader(header); err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue