diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-12 10:24:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 10:24:56 -0400 |
commit | 788c2d136b91f1d714e4665ecd41ea452c72eba0 (patch) | |
tree | f53ca59f233bf4dcd3010b0886038e598060e147 /pkg/bindings | |
parent | bef1f03d3ca8bfd90f4cbb295d99bf97df74a815 (diff) | |
parent | 48ff2ef5a36df054a6aaf30ee34574ee1ec0b6d7 (diff) | |
download | podman-788c2d136b91f1d714e4665ecd41ea452c72eba0.tar.gz podman-788c2d136b91f1d714e4665ecd41ea452c72eba0.tar.bz2 podman-788c2d136b91f1d714e4665ecd41ea452c72eba0.zip |
Merge pull request #10890 from rhatdan/main
Don't exclude Dockerfile, Containerfiles from tar content
Diffstat (limited to 'pkg/bindings')
-rw-r--r-- | pkg/bindings/images/build.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go index 95d9d4df7..3fbc41f99 100644 --- a/pkg/bindings/images/build.go +++ b/pkg/bindings/images/build.go @@ -301,6 +301,8 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO tarContent := []string{options.ContextDirectory} newContainerFiles := []string{} + + dontexcludes := []string{"!Dockerfile", "!Containerfile"} for _, c := range containerFiles { if c == "/dev/stdin" { content, err := ioutil.ReadAll(os.Stdin) @@ -328,6 +330,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO // Do NOT add to tarfile if strings.HasPrefix(containerfile, contextDir+string(filepath.Separator)) { containerfile = strings.TrimPrefix(containerfile, contextDir+string(filepath.Separator)) + dontexcludes = append(dontexcludes, "!"+containerfile) } else { // If Containerfile does not exists assume it is in context directory, do Not add to tarfile if _, err := os.Lstat(containerfile); err != nil { @@ -349,8 +352,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO } params.Set("dockerfile", string(cFileJSON)) } - - tarfile, err := nTar(excludes, tarContent...) + tarfile, err := nTar(append(excludes, dontexcludes...), tarContent...) if err != nil { logrus.Errorf("cannot tar container entries %v error: %v", tarContent, err) return nil, err |