-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerizeConfiguration.cs
More file actions
60 lines (48 loc) · 2.08 KB
/
DockerizeConfiguration.cs
File metadata and controls
60 lines (48 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System.Collections.Generic;
using Microsoft.DotNet.Cli.Utils;
// ReSharper disable once CheckNamespace
namespace Brthor.Dockerize
{
public class DockerizeConfiguration
{
private string _generatedImageTag;
/// <summary>
/// The base docker image used for the generated docker file. If you change this from the default, be sure to
/// update BaseRid if appropriate. Defaults to "microsoft/dotnet:2.0-runtime".
/// </summary>
public string BaseImage { get; }
/// <summary>
/// The RID of the specified Base Docker image. Defaults to "linux-x64".
/// </summary>
public string BaseRid { get; }
public string GeneratedImageTag { get; }
public string BuildConfiguration { get; }
public string Username { get; }
public List<string> ExposedPorts { get; }
public bool DryRun { get; }
public DockerizeConfiguration(
string projectName,
string configuration,
string tag,
string baseRid,
string baseImage,
bool dryRun,
string username,
List<string> exposedPorts)
{
GeneratedImageTag = tag ?? projectName;
BaseRid = baseRid ?? "linux-x64";
BaseImage = baseImage ?? "microsoft/dotnet:2.0-runtime";
BuildConfiguration = configuration ?? "Release";
DryRun = dryRun;
Username = username;
ExposedPorts = exposedPorts;
Reporter.Output.WriteLine($"Dockerize.NET".Blue());
Reporter.Output.WriteLine("Base Docker Image: ".White() + $"{BaseImage}".Green());
Reporter.Output.WriteLine("Base Rid of Docker Image: ".White() + $"{BaseRid}".Green());
Reporter.Output.WriteLine("Tag: ".White() + $"{GeneratedImageTag}".Green());
if (!string.IsNullOrWhiteSpace(Username))
Reporter.Output.WriteLine("Username: ".White() + $"{Username}".Green());
}
}
}