Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Composition;
using System.IO;
Expand Down Expand Up @@ -39,16 +39,23 @@ protected override async Task OnFileFound(ProcessRequest processRequest, IDictio
var singleFileComponentRecorder = processRequest.SingleFileComponentRecorder;
var file = processRequest.ComponentStream;
var filePath = file.Location;
this.Logger.LogInfo($"Discovered dockerfile: {file.Location}");
try
{
this.Logger.LogInfo($"Discovered dockerfile: {file.Location}");

string contents;
using (var reader = new StreamReader(file.Stream))
string contents;
using (var reader = new StreamReader(file.Stream))
{
contents = await reader.ReadToEndAsync();
}

var stageNameMap = new Dictionary<string, string>();
var dockerFileComponent = this.ParseDockerFile(contents, file.Location, singleFileComponentRecorder, stageNameMap);
} catch (Exception e)
{
contents = await reader.ReadToEndAsync();
this.Logger.LogError($"The file doesn't appear to be a Dockerfile: '{file.Location}'");
this.Logger.LogException(e, false);
}

var stageNameMap = new Dictionary<string, string>();
var dockerFileComponent = this.ParseDockerFile(contents, file.Location, singleFileComponentRecorder, stageNameMap);
}

private Task ParseDockerFile(string fileContents, string fileLocation, ISingleFileComponentRecorder singleFileComponentRecorder, Dictionary<string, string> stageNameMap)
Expand Down