Skip to content

Commit

Permalink
fix: compare relative paths when excluding, fixes kreuzwerker#280
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelmeulemans committed Nov 26, 2021
1 parent f8422a5 commit 8b85dff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions internal/provider/resource_docker_registry_image_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func buildDockerImageContextTar(buildContext string) (string, error) {

pm, err := fileutils.NewPatternMatcher(excludes)
if err != nil {
return "", fmt.Errorf("unable to create pattern matcher from .dockerignore exlcudes - %v", err.Error())
return "", fmt.Errorf("unable to create pattern matcher from .dockerignore excludes - %v", err.Error())
}

tw := tar.NewWriter(tmpFile)
Expand All @@ -305,7 +305,8 @@ func buildDockerImageContextTar(buildContext string) (string, error) {
}

// if .dockerignore is present, ignore files from there
skip, err := pm.Matches(file)
rel, _ := filepath.Rel(buildContext, file)
skip, err := pm.Matches(rel)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM scratch
COPY empty /empty
COPY empty* /

0 comments on commit 8b85dff

Please sign in to comment.