mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Docker enhancements
This commit is contained in:
parent
334488919f
commit
8fa58a4841
6 changed files with 27 additions and 3 deletions
|
@ -534,7 +534,7 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
|
||||
private static async Task RestartOrExit() {
|
||||
if (Program.GlobalConfig.AutoRestart) {
|
||||
if (!Program.ServiceMode && Program.GlobalConfig.AutoRestart) {
|
||||
ArchiLogger.LogGenericInfo(Strings.Restarting);
|
||||
await Task.Delay(5000).ConfigureAwait(false);
|
||||
await Program.Restart().ConfigureAwait(false);
|
||||
|
|
|
@ -29,7 +29,7 @@ using ArchiSteamFarm.Localization;
|
|||
namespace ArchiSteamFarm {
|
||||
internal static class Events {
|
||||
internal static async void OnBotShutdown() {
|
||||
if (IPC.KeepRunning || Bot.Bots.Values.Any(bot => bot.KeepRunning)) {
|
||||
if (Program.ServiceMode || IPC.KeepRunning || Bot.Bots.Values.Any(bot => bot.KeepRunning)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace ArchiSteamFarm {
|
|||
|
||||
internal static GlobalConfig GlobalConfig { get; private set; }
|
||||
internal static GlobalDatabase GlobalDatabase { get; private set; }
|
||||
internal static bool ServiceMode { get; private set; }
|
||||
internal static WebBrowser WebBrowser { get; private set; }
|
||||
|
||||
private static readonly object ConsoleLock = new object();
|
||||
|
@ -396,6 +397,9 @@ namespace ArchiSteamFarm {
|
|||
case "--server":
|
||||
IPC.Start();
|
||||
break;
|
||||
case "--service":
|
||||
ServiceMode = true;
|
||||
break;
|
||||
default:
|
||||
if (arg.StartsWith("--", StringComparison.Ordinal)) {
|
||||
if (arg.StartsWith("--cryptkey=", StringComparison.Ordinal) && (arg.Length > 11)) {
|
||||
|
|
8
ArchiSteamFarm/scripts/generic/ArchiSteamFarm-Service.sh
Executable file
8
ArchiSteamFarm/scripts/generic/ArchiSteamFarm-Service.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -eu
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
while [[ -f ArchiSteamFarm.dll ]]; do
|
||||
dotnet ArchiSteamFarm.dll --service # We will abort the script if ASF exits with an error
|
||||
sleep 1
|
||||
done
|
|
@ -3,7 +3,7 @@ WORKDIR /app
|
|||
COPY . ./
|
||||
RUN dotnet publish ArchiSteamFarm -c Release -o out /nologo
|
||||
|
||||
FROM microsoft/dotnet:2.0-runtime
|
||||
FROM microsoft/dotnet:2.0-runtime
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/ArchiSteamFarm/out ./
|
||||
ENTRYPOINT ["dotnet", "ArchiSteamFarm.dll"]
|
||||
|
|
12
Dockerfile.Service
Normal file
12
Dockerfile.Service
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM microsoft/dotnet:2.0-sdk AS build-env
|
||||
WORKDIR /app
|
||||
COPY . ./
|
||||
RUN dotnet publish ArchiSteamFarm -c Release -o out /nologo && \
|
||||
echo "generic" > "ArchiSteamFarm/out/ArchiSteamFarm.version" && \
|
||||
cp "ArchiSteamFarm/scripts/generic/ArchiSteamFarm-Service.sh" "ArchiSteamFarm/out/ArchiSteamFarm-Service.sh" && \
|
||||
chmod +x "ArchiSteamFarm/out/ArchiSteamFarm-Service.sh"
|
||||
|
||||
FROM microsoft/dotnet:2.0-runtime
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/ArchiSteamFarm/out ./
|
||||
ENTRYPOINT ["./ArchiSteamFarm-Service.sh"]
|
Loading…
Reference in a new issue