private void InitializeFromImage() { Match fromMatch = FromRegex.Match(File.ReadAllText(Path.Combine(Model.Dockerfile, "Dockerfile"))); if (!fromMatch.Success) { throw new InvalidOperationException($"Unable to find the FROM image in {Model.Dockerfile}."); } FromImage = fromMatch.Groups["fromImage"].Value; }
private void InitializeFromImages() { string dockerfile = File.ReadAllText(this.DockerfilePath); IEnumerable <Match> fromMatches = FromRegex.Matches(dockerfile).Cast <Match>(); if (!fromMatches.Any()) { throw new InvalidOperationException($"Unable to find a FROM image in {this.DockerfilePath}."); } FromImages = fromMatches.Select(match => match.Groups["fromImage"].Value).ToArray(); }
private void InitializeFromImages() { string dockerfile = File.ReadAllText(DockerfilePath); IList <Match> fromMatches = FromRegex.Matches(dockerfile); if (!fromMatches.Any()) { throw new InvalidOperationException($"Unable to find a FROM image in {DockerfilePath}."); } FromImages = fromMatches .Select(match => match.Groups[FromImageMatchName].Value) .Where(from => !IsStageReference(from, fromMatches) && !from.Contains("$")) .ToArray(); }