diff --git a/DbQuery/CommandBase.cs b/DbQuery/CommandBase.cs index 6d7943a..4368355 100644 --- a/DbQuery/CommandBase.cs +++ b/DbQuery/CommandBase.cs @@ -25,6 +25,6 @@ protected static void Wait() { Console.WriteLine(); Console.Write("Press any key..."); - Console.ReadKey(true); + // Console.ReadKey(true); } } \ No newline at end of file diff --git a/DbQuery/Program.cs b/DbQuery/Program.cs index c84433c..f6b8a3f 100644 --- a/DbQuery/Program.cs +++ b/DbQuery/Program.cs @@ -21,7 +21,7 @@ private async Task ExecuteAsync(string[] args) // help if (command == null) { - ShowHelp(); + // ShowHelp(); return; } @@ -195,15 +195,17 @@ private static void ShowHelp() TestSqlConnectionCommand.ShowHelp(); TestVersionCommand.ShowHelp(); TestEmptyTableCommand.ShowHelp(); - Wait(); + // Wait(); } + /* private static void Wait() { Console.WriteLine(); Console.Write("Press any key..."); Console.ReadKey(true); } + */ static async Task Main(string[] args) => await new Program().ExecuteAsync(args); diff --git a/DbQuery/TestServerCommand.cs b/DbQuery/TestServerCommand.cs index 444b413..4269927 100644 --- a/DbQuery/TestServerCommand.cs +++ b/DbQuery/TestServerCommand.cs @@ -115,8 +115,8 @@ internal static void ShowHelp() Console.WriteLine(" Output:"); Console.WriteLine(" Exit code -1: database server not available"); Console.WriteLine(" Exit code -2: invalid database connection string"); - Console.WriteLine(" Examples:"); - Console.WriteLine(" TestServer 'server=localhost;database=MyDatabase; Integrated Security=SSPI;TrustServerCertificate=True;' 2"); - Wait(); + Console.WriteLine("Examples:"); + Console.WriteLine(" TestServer 'server=localhost;database=MyDatabase; Integrated Security=SSPI;TrustServerCertificate=True;' 2"); + //Wait(); // disabled for docker compatibility } } \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index d592c99..2c4de0a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net8.0 + net9.0 1.0.16 1.0.16 1.0.16 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5b3f54d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM mcr.microsoft.com/dotnet/sdk:9.0 +WORKDIR /src + +# copy solution and project files +COPY ["PayrollEngine.SqlServer.DbQuery.sln", "./"] +COPY ["DbQuery/PayrollEngine.SqlServer.DbQuery.csproj", "DbQuery/"] + +# copy Directory.Build.props +COPY ["Directory.Build.props", "./"] + +RUN dotnet restore "PayrollEngine.SqlServer.DbQuery.sln" + +# copy everything else +COPY . . +WORKDIR "/src/DbQuery" +RUN dotnet publish "PayrollEngine.SqlServer.DbQuery.csproj" -c Release -o /app/publish --no-restore + +# final stage +FROM mcr.microsoft.com/dotnet/runtime:9.0 +WORKDIR /app +COPY --from=0 /app/publish . +ENTRYPOINT ["dotnet", "PayrollEngine.SqlServer.DbQuery.dll"] \ No newline at end of file