func (dc *DockerV1) getSourceRelativePath(sourceFile string) string {
	if dc.absRootDir == "" {
		return filepath.Base(sourceFile)
	}
	relPath, err := filepath.Rel(dc.absRootDir, sourceFile)
	if err != nil {
		zap.S().Debug("error while getting the relative path for", zap.String("IAC file", sourceFile), zap.Error(err))
		return sourceFile
	}
	return relPath
}
getSourceRelativePath fetches the relative path of file being loaded
package dockerv1
import (
	"crypto/md5"
	"encoding/hex"
	"errors"
	"fmt"
	"path/filepath"
	"strconv"
	"strings"
	"github.com/accurics/terrascan/pkg/iac-providers/output"
	"github.com/accurics/terrascan/pkg/utils"
	"go.uber.org/zap"
)
const (
	docker                 string = "docker"
	resourceTypeDockerfile string = "dockerfile"
	underScoreSeparator    string = "_"
	dockerFromInstruction  string = "from"
	dockerScratchImage     string = "scratch"
	IDConnectorString        string = "."
	dockerResourceTypePrefix        = docker + underScoreSeparator
)
func (dc *DockerV1) LoadIacFile(absFilePath string, options map[string]interface{}) (allResourcesConfig output.AllResourceConfigs, err error) {
	allResourcesConfig = make(map[string][]output.ResourceConfig)
	data, comments, err := dc.Parse(absFilePath)
	if err != nil {
		errMsg := fmt.Sprintf("error while parsing dockerfile %s, error: %v", absFilePath, err)
		zap.S().Errorf("error while parsing dockerfile %s", absFilePath, err)
		return allResourcesConfig, errors.New(errMsg)
	}
	minSeverity, maxSeverity := utils.GetMinMaxSeverity(comments)
	skipRules := utils.GetSkipRules(comments)
	dockerCommand := []string{}
	for i := 0; i < len(data); i++ {
		dockerCommand = append(dockerCommand, data[i].Cmd)
		config := output.ResourceConfig{
			Name:        filepath.Base(absFilePath),
			Type:        dockerResourceTypePrefix + data[i].Cmd,
			Line:        data[i].Line,
			ID:          dockerResourceTypePrefix + data[i].Cmd + IDConnectorString + GetresourceIdforDockerfile(absFilePath, data[i].Value, data[i].Line),
			Source:      dc.getSourceRelativePath(absFilePath),
			Config:      data[i].Value,
			SkipRules:   skipRules,
			MinSeverity: minSeverity,
			MaxSeverity: maxSeverity,
		}
		if data[i].Cmd == dockerFromInstruction && strings.Fields(data[i].Value)[0] != dockerScratchImage {
			config.ContainerImages = append(config.ContainerImages, output.ContainerDetails{
				Image: strings.Fields(data[i].Value)[0],
			})
		}
		allResourcesConfig[config.Type] = append(allResourcesConfig[config.Type], config)
	}
	config := output.ResourceConfig{
		Name:        filepath.Base(absFilePath),
		Type:        dockerResourceTypePrefix + resourceTypeDockerfile,
		Line:        1,
		ID:          dockerResourceTypePrefix + resourceTypeDockerfile + IDConnectorString + GetresourceIdforDockerfile(absFilePath, "", 1),
		Source:      dc.getSourceRelativePath(absFilePath),
		Config:      dockerCommand,
		SkipRules:   skipRules,
		MinSeverity: minSeverity,
		MaxSeverity: maxSeverity,
	}
	allResourcesConfig[config.Type] = append(allResourcesConfig[config.Type], config)
	return allResourcesConfig, nil
}