mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-18 10:08:11 +02:00
Remove support for .dockerignore
Remove support for .dockerignore file until I can change it to ignore files in memory instead of deleting them Refer to #466
This commit is contained in:
@@ -25,10 +25,8 @@ import (
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/buildcontext"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/config"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/constants"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/dockerfile"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/executor"
|
||||
"github.com/GoogleContainerTools/kaniko/pkg/util"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/genuinetools/amicontained/container"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -67,7 +65,7 @@ var RootCmd = &cobra.Command{
|
||||
if err := resolveDockerfilePath(); err != nil {
|
||||
return errors.Wrap(err, "error resolving dockerfile path")
|
||||
}
|
||||
return removeIgnoredFiles()
|
||||
return nil
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if !checkContained() {
|
||||
@@ -200,29 +198,6 @@ func resolveSourceContext() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeIgnoredFiles() error {
|
||||
if !dockerfile.DockerignoreExists(opts) {
|
||||
return nil
|
||||
}
|
||||
ignore, err := dockerfile.ParseDockerignore(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
logrus.Infof("Removing ignored files from build context: %s", ignore)
|
||||
files, err := util.RelativeFiles("", opts.SrcContext)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "getting all files in src context")
|
||||
}
|
||||
for _, f := range files {
|
||||
if rm, _ := fileutils.Matches(f, ignore); rm {
|
||||
if err := os.RemoveAll(f); err != nil {
|
||||
logrus.Errorf("Error removing %s from build context", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func exit(err error) {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
||||
Reference in New Issue
Block a user