Browse Source

made usage of 'Dockerfile' consistent as well as 'multi/single-phase'

pull/171/head
Chad Jessup 7 years ago
committed by Ryan Nowak
parent
commit
96207c9af0
  1. 2
      src/Microsoft.Tye.Core/ContainerInfo.cs
  2. 6
      src/Microsoft.Tye.Core/DockerContainerBuilder.cs
  3. 4
      src/Microsoft.Tye.Core/DockerfileGenerator.cs
  4. 2
      src/Microsoft.Tye.Core/PublishProjectStep.cs

2
src/Microsoft.Tye.Core/ContainerInfo.cs

@ -42,7 +42,7 @@ namespace Microsoft.Tye
public string? ImageTag { get; set; } public string? ImageTag { get; set; }
/// <summary> /// <summary>
/// Gets or a sets value which determines whether a multiphase dockerfile is used. /// Gets or a sets value which determines whether a multi-phase Dockerfile is used.
/// </summary> /// </summary>
public bool? UseMultiphaseDockerfile { get; set; } public bool? UseMultiphaseDockerfile { get; set; }
} }

6
src/Microsoft.Tye.Core/DockerContainerBuilder.cs

@ -44,7 +44,7 @@ namespace Microsoft.Tye
var dockerFilePath = Path.Combine(application.GetProjectDirectory(project), Path.GetDirectoryName(project.RelativeFilePath)!, "Dockerfile"); var dockerFilePath = Path.Combine(application.GetProjectDirectory(project), Path.GetDirectoryName(project.RelativeFilePath)!, "Dockerfile");
if (File.Exists(dockerFilePath)) if (File.Exists(dockerFilePath))
{ {
output.WriteDebugLine($"Using existing dockerfile '{dockerFilePath}'."); output.WriteDebugLine($"Using existing Dockerfile '{dockerFilePath}'.");
} }
else else
{ {
@ -52,7 +52,7 @@ namespace Microsoft.Tye
dockerFilePath = tempFile.FilePath; dockerFilePath = tempFile.FilePath;
} }
// We need to know if this is a single-phase or multi-phase dockerfile because the context directory will be // We need to know if this is a single-phase or multi-phase Dockerfile because the context directory will be
// different depending on that choice. // different depending on that choice.
string contextDirectory; string contextDirectory;
if (container.UseMultiphaseDockerfile ?? true) if (container.UseMultiphaseDockerfile ?? true)
@ -64,7 +64,7 @@ namespace Microsoft.Tye
var publishOutput = service.Outputs.OfType<ProjectPublishOutput>().FirstOrDefault(); var publishOutput = service.Outputs.OfType<ProjectPublishOutput>().FirstOrDefault();
if (publishOutput is null) if (publishOutput is null)
{ {
throw new InvalidOperationException("We should have published the project for a single-phase dockerfile."); throw new InvalidOperationException("We should have published the project for a single-phase Dockerfile.");
} }
contextDirectory = publishOutput.Directory.FullName; contextDirectory = publishOutput.Directory.FullName;

4
src/Microsoft.Tye.Core/DockerfileGenerator.cs

@ -48,7 +48,7 @@ namespace Microsoft.Tye
using var writer = new StreamWriter(stream, encoding: Encoding.UTF8, bufferSize: -1, leaveOpen: true); using var writer = new StreamWriter(stream, encoding: Encoding.UTF8, bufferSize: -1, leaveOpen: true);
var entryPoint = Path.GetFileNameWithoutExtension(project.RelativeFilePath); var entryPoint = Path.GetFileNameWithoutExtension(project.RelativeFilePath);
output.WriteDebugLine($"Writing dockerfile to '{filePath}'."); output.WriteDebugLine($"Writing Dockerfile to '{filePath}'.");
if (container.UseMultiphaseDockerfile ?? true) if (container.UseMultiphaseDockerfile ?? true)
{ {
await WriteMultiphaseDockerfileAsync(writer, entryPoint, container); await WriteMultiphaseDockerfileAsync(writer, entryPoint, container);
@ -57,7 +57,7 @@ namespace Microsoft.Tye
{ {
await WriteLocalPublishDockerfileAsync(writer, entryPoint, container); await WriteLocalPublishDockerfileAsync(writer, entryPoint, container);
} }
output.WriteDebugLine("Done writing dockerfile."); output.WriteDebugLine("Done writing Dockerfile.");
} }
private static async Task WriteMultiphaseDockerfileAsync(StreamWriter writer, string applicationEntryPoint, ContainerInfo container) private static async Task WriteMultiphaseDockerfileAsync(StreamWriter writer, string applicationEntryPoint, ContainerInfo container)

2
src/Microsoft.Tye.Core/PublishProjectStep.cs

@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace Microsoft.Tye namespace Microsoft.Tye
{ {
// Used to publish a project when using a single-file dockerfile // Used to publish a project when using a single-phase Dockerfile
public class PublishProjectStep : ServiceExecutor.Step public class PublishProjectStep : ServiceExecutor.Step
{ {
public override string DisplayText => "Publishing Project..."; public override string DisplayText => "Publishing Project...";

Loading…
Cancel
Save