|
@@ -3,8 +3,8 @@ package builder
|
|
import (
|
|
import (
|
|
"os"
|
|
"os"
|
|
|
|
|
|
|
|
+ "github.com/docker/docker/builder/dockerignore"
|
|
"github.com/docker/docker/pkg/fileutils"
|
|
"github.com/docker/docker/pkg/fileutils"
|
|
- "github.com/docker/docker/utils"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
// DockerIgnoreContext wraps a ModifiableContext to add a method
|
|
// DockerIgnoreContext wraps a ModifiableContext to add a method
|
|
@@ -27,7 +27,7 @@ type DockerIgnoreContext struct {
|
|
// TODO: Don't require a ModifiableContext (use Context instead) and don't remove
|
|
// TODO: Don't require a ModifiableContext (use Context instead) and don't remove
|
|
// files, instead handle a list of files to be excluded from the context.
|
|
// files, instead handle a list of files to be excluded from the context.
|
|
func (c DockerIgnoreContext) Process(filesToRemove []string) error {
|
|
func (c DockerIgnoreContext) Process(filesToRemove []string) error {
|
|
- dockerignore, err := c.Open(".dockerignore")
|
|
|
|
|
|
+ f, err := c.Open(".dockerignore")
|
|
// Note that a missing .dockerignore file isn't treated as an error
|
|
// Note that a missing .dockerignore file isn't treated as an error
|
|
if err != nil {
|
|
if err != nil {
|
|
if os.IsNotExist(err) {
|
|
if os.IsNotExist(err) {
|
|
@@ -35,7 +35,7 @@ func (c DockerIgnoreContext) Process(filesToRemove []string) error {
|
|
}
|
|
}
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
- excludes, _ := utils.ReadDockerIgnore(dockerignore)
|
|
|
|
|
|
+ excludes, _ := dockerignore.ReadAll(f)
|
|
filesToRemove = append([]string{".dockerignore"}, filesToRemove...)
|
|
filesToRemove = append([]string{".dockerignore"}, filesToRemove...)
|
|
for _, fileToRemove := range filesToRemove {
|
|
for _, fileToRemove := range filesToRemove {
|
|
rm, _ := fileutils.Matches(fileToRemove, excludes)
|
|
rm, _ := fileutils.Matches(fileToRemove, excludes)
|