func GetFilePaths(workDir, dockerfile string, buildArgs []string) ([]string, error) {
	dfPath := filepath.ToSlash(filepath.Join(workDir, dockerfile))
	f, err := os.Open(dfPath)
	if err != nil {
		return nil, errors.Wrap(err, "opening dockerfile")
	}
	result, err := parser.Parse(f)
	if err != nil {
		return nil, errors.Wrap(err, "parsing dockerfile")
	}
	var paths []string
	children := result.AST.Children
	envVars := make(map[string]string)
	args, err := parseBuildArgs(buildArgs)
	if err != nil {
		return nil, errors.Wrap(err, "parsing build args from flags")
	}
	for _, node := range children {
		switch node.Value {
		case command.Copy, command.Add:
			parsed, err := parseCopyOrAdd(workDir, node, envVars, args)
			if err != nil {
				return nil, errors.Wrap(err, fmt.Sprintf("Dockerfile line %d", node.StartLine))
			}
			paths = append(paths, parsed...)
		case command.Env:
			envVars[node.Next.Value] = node.Next.Next.Value
		case command.Arg:
			err := parseArgCommand(node, args)
			if err != nil {
				return nil, err
			}
		}
	}
	paths = append(paths, dfPath)  
	return paths, nil
}
GetFilePaths returns all paths required to build the docker image
package docker
import (
	"fmt"
	"os"
	"path/filepath"
	"regexp"
	"strings"
	"github.com/moby/buildkit/frontend/dockerfile/command"
	"github.com/moby/buildkit/frontend/dockerfile/parser"
	"github.com/moby/buildkit/frontend/dockerfile/shell"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)
var urlRegex = regexp.MustCompile("^https?://(.*)")