Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Sep 27, 2023
1 parent daec5d9 commit 3df21ac
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions xray/commands/scan/dockerscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type DockerScanCommand struct {
ScanCommand
imageTag string
targetRepoPath string
dockerFilePath string
}

func NewDockerScanCommand() *DockerScanCommand {
Expand Down Expand Up @@ -84,7 +83,6 @@ func (dsc *DockerScanCommand) Run() (err error) {
}

// Map layers sha to build commands
// If dockerfile exists, will also map to line number.
dockerCommandsMapping, err := dsc.mapDockerLayerToCommand()
if err != nil {
return
Expand Down Expand Up @@ -125,25 +123,6 @@ func (dsc *DockerScanCommand) Run() (err error) {
return dsc.ScanCommand.handlePossibleErrors(extendedScanResults.XrayResults, scanErrors, err)
}

func (dsc *DockerScanCommand) buildDockerImage() (err error) {
if exists, _ := fileutils.IsFileExists(".dockerfile", false); !exists {
return fmt.Errorf("didn't find Dockerfile in the provided path: %s", dsc.dockerFilePath)
}
if dsc.progress != nil {
dsc.progress.SetHeadlineMsg("Building Docker image 🏗....️")
}
dsc.imageTag = "audittag"
log.Info("Building docker image... ")
var stderr bytes.Buffer
dockerBuildCommand := exec.Command("docker", "build", ".", "-f", ".dockerfile", "-t", dsc.imageTag)
dockerBuildCommand.Stderr = &stderr
if err = dockerBuildCommand.Run(); err != nil {
return fmt.Errorf("failed to build docker image. Is docker running on your computer? error: %s", err.Error())
}
log.Info("Successfully build image from dockerfile")
return
}

func (dsc *DockerScanCommand) mapDockerLayerToCommand() (layersMapping map[string]services.DockerfileCommandDetails, err error) {
log.Debug("Mapping docker layers into commands ")
resolver, err := dive.GetImageResolver(dive.SourceDockerEngine)
Expand Down

0 comments on commit 3df21ac

Please sign in to comment.