summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-15 08:15:11 -0400
committerGitHub <noreply@github.com>2021-07-15 08:15:11 -0400
commit47f351769bbf9e06ec47d340943e5a494d586e79 (patch)
tree29a7918e71c800ef3571635ee05e9a4cda901bb2 /pkg
parent61245884abb181ee4dd46280a56dec5f25d2432d (diff)
parentc9970647ba6338aeb29c1bd82d8f22f33b1880b9 (diff)
downloadpodman-47f351769bbf9e06ec47d340943e5a494d586e79.tar.gz
podman-47f351769bbf9e06ec47d340943e5a494d586e79.tar.bz2
podman-47f351769bbf9e06ec47d340943e5a494d586e79.zip
Merge pull request #10913 from rhatdan/build
podman-remote build use .containerignore over .dockerignore
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bindings/images/build.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index 3fbc41f99..142204f27 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -302,7 +302,7 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
tarContent := []string{options.ContextDirectory}
newContainerFiles := []string{}
- dontexcludes := []string{"!Dockerfile", "!Containerfile"}
+ dontexcludes := []string{"!Dockerfile", "!Containerfile", "!.dockerignore", "!.containerignore"}
for _, c := range containerFiles {
if c == "/dev/stdin" {
content, err := ioutil.ReadAll(os.Stdin)
@@ -550,9 +550,13 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
}
func parseDockerignore(root string) ([]string, error) {
- ignore, err := ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
- if err != nil && !os.IsNotExist(err) {
- return nil, errors.Wrapf(err, "error reading .dockerignore: '%s'", root)
+ ignore, err := ioutil.ReadFile(filepath.Join(root, ".containerignore"))
+ if err != nil {
+ var dockerIgnoreErr error
+ ignore, dockerIgnoreErr = ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
+ if dockerIgnoreErr != nil && !os.IsNotExist(dockerIgnoreErr) {
+ return nil, errors.Wrapf(err, "error reading .containerignore: '%s'", root)
+ }
}
rawexcludes := strings.Split(string(ignore), "\n")
excludes := make([]string, 0, len(rawexcludes))