internal KubernetesDotnetAppDockerfileFile(string file) { File = file; if (Exists()) { Load(); } else { KubernetesDotnetAppDockerfile = new KubernetesDotnetAppDockerfile(); } }
private void Load() { Logger.LogDebug($"loading kubernetes dotnet app dockerfile from {File}"); string text = System.IO.File.ReadAllText(File); KubernetesDotnetAppDockerfile = new KubernetesDotnetAppDockerfile() { BaseImage = new Regex(@"^FROM\s+(\S+)", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), App = new Regex(@"^CMD dotnet /app/(.+)\.dll\s+", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), BuildPath = new Regex(@"^COPY (.+) /app\s+", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), }; }
private void Load() { Logger.LogDebug($"loading kubernetes dotnet app dockerfile from {File}"); string text = System.IO.File.ReadAllText(File); KubernetesDotnetAppDockerfile = new KubernetesDotnetAppDockerfile() { BaseImage = new Regex(@"^FROM\s+(\S+)", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), App = new Regex(@"^CMD dotnet (.+)\.dll\s+", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), AppPath = new Regex(@"^WORKDIR\s+(\S+)", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), BuildPath = new Regex(@"^COPY\s+(\S+)", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), Environment = new Regex(@"^ENV\s+ASPNETCORE_ENVIRONMENT\s+(\S+)", RegexOptions.Multiline) .Match(text).Groups[1].ToString(), }; }