From 3df21ac86813ee162b6788d9cda792a904b46970 Mon Sep 17 00:00:00 2001 From: delarea Date: Wed, 27 Sep 2023 15:20:09 +0300 Subject: [PATCH] Remove unused code --- xray/commands/scan/dockerscan.go | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/xray/commands/scan/dockerscan.go b/xray/commands/scan/dockerscan.go index 982c66e81..54adf9fe2 100644 --- a/xray/commands/scan/dockerscan.go +++ b/xray/commands/scan/dockerscan.go @@ -30,7 +30,6 @@ type DockerScanCommand struct { ScanCommand imageTag string targetRepoPath string - dockerFilePath string } func NewDockerScanCommand() *DockerScanCommand { @@ -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 @@ -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)