diff --git a/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/Dockerfile b/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/Dockerfile new file mode 100644 index 0000000..372617c --- /dev/null +++ b/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder +WORKDIR /lrm +COPY . . +RUN [\ + "dotnet", "publish", \ + "--output", "/build/", \ + "--configuration", "Release",\ + "--no-self-contained", \ + "." ] + +FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine +WORKDIR /lrm-lb +COPY --from=builder /build/ . +ENV LRM_LB_CONFIG_PATH="/config/config-load-balancer.json" +CMD [ "./LRM_LoadBalancer" ] +ENTRYPOINT [ "./LRM_LoadBalancer" ] \ No newline at end of file diff --git a/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Program.cs b/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Program.cs index 5e9d7bb..ef4c8eb 100644 --- a/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Program.cs +++ b/LoadBalancerProject-DONT-IMPORT-INTO-UNITY/LRM_LoadBalancer/Program.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; @@ -18,7 +18,7 @@ namespace LightReflectiveMirror.LoadBalancing private int _pingDelay = 10000; const string API_PATH = "/api/stats"; - const string CONFIG_PATH = "config.json"; + readonly string CONFIG_PATH = System.Environment.GetEnvironmentVariable("LRM_LB_CONFIG_PATH") ?? "config.json"; public static Config conf; public static Program instance; diff --git a/ServerProject-DONT-IMPORT-INTO-UNITY/Dockerfile b/ServerProject-DONT-IMPORT-INTO-UNITY/Dockerfile new file mode 100644 index 0000000..96f3186 --- /dev/null +++ b/ServerProject-DONT-IMPORT-INTO-UNITY/Dockerfile @@ -0,0 +1,17 @@ +FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS builder +WORKDIR /lrm +COPY . . +RUN [\ + "dotnet", "publish", \ + "--output", "/build/", \ + "--configuration", "Release",\ + "--no-self-contained", \ + "." ] + +FROM mcr.microsoft.com/dotnet/runtime:5.0-alpine +WORKDIR /lrm +COPY --from=builder /build/ . +COPY ./MultiCompiled.dll . +ENV LRM_CONFIG_PATH="/config/config.json" +CMD [ "./LRM" ] +ENTRYPOINT [ "./LRM" ] \ No newline at end of file diff --git a/ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Program.cs b/ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Program.cs index bc4d8f3..d3b35e0 100644 --- a/ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Program.cs +++ b/ServerProject-DONT-IMPORT-INTO-UNITY/LRM/Program.cs @@ -37,7 +37,7 @@ namespace LightReflectiveMirror private UdpClient _punchServer; - private const string CONFIG_PATH = "config.json"; + private readonly string CONFIG_PATH = System.Environment.GetEnvironmentVariable("LRM_CONFIG_PATH") ?? "config.json"; public static void Main(string[] args) => new Program().MainAsync().GetAwaiter().GetResult(); @@ -67,7 +67,7 @@ namespace LightReflectiveMirror WriteLogMessage("Loading Assembly... ", ConsoleColor.White, true); try { - var asm = Assembly.LoadFile(Directory.GetCurrentDirectory() + @"\" + conf.TransportDLL); + var asm = Assembly.LoadFile(Path.GetFullPath(conf.TransportDLL)); WriteLogMessage($"OK", ConsoleColor.Green); WriteLogMessage("\nLoading Transport Class... ", ConsoleColor.White, true);