Skip to content

Commit cd98295

Browse files
committed
replace dockerfile/dockerignore with patternmatcher/ignorefile
The BuildKit dockerignore package was migrated to the patternmatcher repository / module. This patch updates our uses of the BuildKit package with its new location. A small local change was made to keep the format of the existing error message, because the "ignorefile" package is slightly more agnostic in that respect and doesn't include ".dockerignore" in the error message. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent d70deb8 commit cd98295

3 files changed

Lines changed: 8 additions & 68 deletions

File tree

cli/command/image/build/dockerignore.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package build
22

33
import (
4+
"fmt"
45
"os"
56
"path/filepath"
67

7-
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
88
"github.com/moby/patternmatcher"
9+
"github.com/moby/patternmatcher/ignorefile"
910
)
1011

1112
// ReadDockerignore reads the .dockerignore file in the context directory and
@@ -22,7 +23,11 @@ func ReadDockerignore(contextDir string) ([]string, error) {
2223
}
2324
defer f.Close()
2425

25-
return dockerignore.ReadAll(f)
26+
out, err := ignorefile.ReadAll(f)
27+
if err != nil {
28+
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
29+
}
30+
return out, nil
2631
}
2732

2833
// TrimBuildFilesFromExcludes removes the named Dockerfile and .dockerignore from

vendor/github.com/moby/buildkit/frontend/dockerfile/dockerignore/dockerignore.go

Lines changed: 0 additions & 65 deletions
This file was deleted.

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ github.com/miekg/pkcs11
167167
github.com/mitchellh/mapstructure
168168
# github.com/moby/buildkit v0.11.6
169169
## explicit; go 1.18
170-
github.com/moby/buildkit/frontend/dockerfile/dockerignore
171170
github.com/moby/buildkit/util/appcontext
172171
# github.com/moby/patternmatcher v0.6.0
173172
## explicit; go 1.19
174173
github.com/moby/patternmatcher
174+
github.com/moby/patternmatcher/ignorefile
175175
# github.com/moby/swarmkit/v2 v2.0.0-20230713153928-bc71908479e5
176176
## explicit; go 1.18
177177
github.com/moby/swarmkit/v2/api

0 commit comments

Comments
 (0)