docker files

This commit is contained in:
Muka Schultze 2021-04-06 01:55:52 -03:00
parent fddd354772
commit d62a7d6e39
4 changed files with 37 additions and 4 deletions

View file

@ -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" ]

View file

@ -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;

View file

@ -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" ]

View file

@ -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);