Skip to content

Commit bc9d696

Browse files
authored
Merge pull request docker#10922 from thaJeztah/replace_dockerignore
replace dockerfile/dockerignore with patternmatcher/ignorefile
2 parents 6204fb1 + 5d73201 commit bc9d696

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require (
1414
github.com/docker/buildx v0.11.2
1515
github.com/docker/cli v24.0.5+incompatible
1616
github.com/docker/cli-docs-tool v0.6.0
17-
github.com/docker/docker v24.0.5+incompatible // v24.0.5-dev
17+
github.com/docker/docker v24.0.5+incompatible
1818
github.com/docker/go-connections v0.4.0
1919
github.com/docker/go-units v0.5.0
2020
github.com/fsnotify/fsevents v0.1.1
@@ -24,8 +24,8 @@ require (
2424
github.com/jonboulle/clockwork v0.4.0
2525
github.com/mattn/go-shellwords v1.0.12
2626
github.com/mitchellh/mapstructure v1.5.0
27-
github.com/moby/buildkit v0.12.1 // v0.12 release branch
28-
github.com/moby/patternmatcher v0.5.0
27+
github.com/moby/buildkit v0.12.1
28+
github.com/moby/patternmatcher v0.6.0
2929
github.com/moby/term v0.5.0
3030
github.com/morikuni/aec v1.0.0
3131
github.com/opencontainers/go-digest v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@ github.com/moby/buildkit v0.12.1 h1:vvMG7EZYCiQZpTtXQkvyeyj7HzT1JHhDWj+/aiGIzLM=
495495
github.com/moby/buildkit v0.12.1/go.mod h1:adB4y0SxxX8trnrY+oEulb48ODLqPO6pKMF0ppGcCoI=
496496
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
497497
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
498-
github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo=
499-
github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
498+
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
499+
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
500500
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
501501
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
502502
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=

pkg/watch/dockerignore.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"path/filepath"
2323
"strings"
2424

25-
"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
2625
"github.com/moby/patternmatcher"
26+
"github.com/moby/patternmatcher/ignorefile"
2727
)
2828

2929
type dockerPathMatcher struct {
@@ -133,13 +133,17 @@ func readDockerignorePatterns(repoRoot string) ([]string, error) {
133133
}
134134
defer func() { _ = f.Close() }()
135135

136-
return dockerignore.ReadAll(f)
136+
patterns, err := ignorefile.ReadAll(f)
137+
if err != nil {
138+
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
139+
}
140+
return patterns, nil
137141
}
138142

139143
func DockerIgnoreTesterFromContents(repoRoot string, contents string) (*dockerPathMatcher, error) {
140-
patterns, err := dockerignore.ReadAll(strings.NewReader(contents))
144+
patterns, err := ignorefile.ReadAll(strings.NewReader(contents))
141145
if err != nil {
142-
return nil, err
146+
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
143147
}
144148

145149
return NewDockerPatternMatcher(repoRoot, patterns)

0 commit comments

Comments
 (0)