Implemented more life cycle handling. Added support for rootless environments

This commit is contained in:
2024-12-27 20:08:05 +01:00
parent 039db22207
commit 92e9f42fbc
21 changed files with 738 additions and 20 deletions

View File

@@ -0,0 +1,18 @@
using Docker.DotNet;
using MoonlightServers.Daemon.Models;
using MoonlightServers.DaemonShared.Enums;
namespace MoonlightServers.Daemon.Extensions.ServerExtensions;
public static class ServerStartExtensions
{
public static async Task StateMachineHandler_Start(this Server server)
{
await server.ReCreate();
await server.NotifyTask(ServerTask.StartingContainer);
var dockerClient = server.ServiceProvider.GetRequiredService<DockerClient>();
await dockerClient.Containers.StartContainerAsync(server.ContainerId, new());
}
}