Skip to content

Commit

Permalink
replace dockerfile/dockerignore with patternmatcher/ignorefile
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
thaJeztah committed Aug 22, 2023
1 parent d70deb8 commit cd98295
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 68 deletions.
9 changes: 7 additions & 2 deletions cli/command/image/build/dockerignore.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package build

import (
"fmt"
"os"
"path/filepath"

"github.com/moby/buildkit/frontend/dockerfile/dockerignore"
"github.com/moby/patternmatcher"
"github.com/moby/patternmatcher/ignorefile"
)

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

return dockerignore.ReadAll(f)
out, err := ignorefile.ReadAll(f)
if err != nil {
return nil, fmt.Errorf("error reading .dockerignore: %w", err)
}
return out, nil
}

// TrimBuildFilesFromExcludes removes the named Dockerfile and .dockerignore from
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ github.com/miekg/pkcs11
github.com/mitchellh/mapstructure
# github.com/moby/buildkit v0.11.6
## explicit; go 1.18
github.com/moby/buildkit/frontend/dockerfile/dockerignore
github.com/moby/buildkit/util/appcontext
# github.com/moby/patternmatcher v0.6.0
## explicit; go 1.19
github.com/moby/patternmatcher
github.com/moby/patternmatcher/ignorefile
# github.com/moby/swarmkit/v2 v2.0.0-20230713153928-bc71908479e5
## explicit; go 1.18
github.com/moby/swarmkit/v2/api
Expand Down

0 comments on commit cd98295

Please sign in to comment.