Add Dockerfile (#277)
* Add Dockerfile - Added Dockerfile for app - Made the app a bit shorter - Improved app with string interpolation usage * Add trailing CR * Simplify string joining
This commit is contained in:
4
samples/dotnetbot/Dockerfile
Normal file
4
samples/dotnetbot/Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM microsoft/dotnet
|
||||||
|
COPY bin/Debug/netcoreapp1.0 app
|
||||||
|
WORKDIR app
|
||||||
|
ENTRYPOINT ["dotnet", "dotnetbot.dll"]
|
||||||
@@ -1,28 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DotnetBot
|
public static class Program
|
||||||
{
|
{
|
||||||
public static class Program
|
|
||||||
{
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
string message = "";
|
string message = "Dotnet-bot: Welcome to using .NET Core!";
|
||||||
if (args.Length < 1)
|
|
||||||
|
if (args.Length > 0)
|
||||||
{
|
{
|
||||||
message = "Welcome to .NET Core!";
|
message = String.Join(" ",args);
|
||||||
} else
|
|
||||||
{
|
|
||||||
foreach (string item in args)
|
|
||||||
{
|
|
||||||
message += item;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(GetBot(message));
|
Console.WriteLine(GetBot(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetBot(string message)
|
public static string GetBot(string message)
|
||||||
{
|
{
|
||||||
string bot = "\n" + " " + message;
|
string bot = $"\n {message}";
|
||||||
bot += @"
|
bot += @"
|
||||||
__________________
|
__________________
|
||||||
\
|
\
|
||||||
@@ -66,6 +60,4 @@ namespace DotnetBot
|
|||||||
return bot;
|
return bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user