Fixing dockerfile and async bug

This commit is contained in:
Joseph Ferano 2022-01-19 21:41:14 +07:00
parent fd9a6a25f3
commit bc3e574841
7 changed files with 51 additions and 31 deletions

12
.config/dotnet-tools.json Normal file
View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "6.2.1",
"commands": [
"paket"
]
}
}
}

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY . .
RUN dotnet tool restore
RUN dotnet restore "PlayerInteractions/PlayerInteractions.fsproj"
WORKDIR "/src/PlayerInteractions"
RUN dotnet build "PlayerInteractions.fsproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PlayerInteractions.fsproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT "./PlayerInteractions"

View File

@ -41,17 +41,20 @@ let storeBot = new DiscordClient(storeConfig)
let slotMachineBot = new DiscordClient(slotMachineConfig) let slotMachineBot = new DiscordClient(slotMachineConfig)
let clients = [| playerInteractionsBot ; trainerBot ; hackerBattleBot ; storeBot ; slotMachineBot |] let clients = [| playerInteractionsBot ; trainerBot ; hackerBattleBot ; storeBot ; slotMachineBot |]
let slashCommands =
clients let sc1 = playerInteractionsBot.UseSlashCommands()
|> Array.map (fun c -> c.UseSlashCommands()) let sc2 = trainerBot.UseSlashCommands()
let sc3 = hackerBattleBot.UseSlashCommands()
let sc4 = storeBot.UseSlashCommands()
let sc5 = slotMachineBot.UseSlashCommands()
// My server // My server
let joeServer = 922419263275425832uL let joeServer = 922419263275425832uL
slashCommands.[0].RegisterCommands<PlayerInteractions>(joeServer); sc1.RegisterCommands<PlayerInteractions>(joeServer);
slashCommands.[1].RegisterCommands<Trainer>(joeServer); sc2.RegisterCommands<Trainer>(joeServer);
slashCommands.[2].RegisterCommands<HackerGame>(joeServer); sc3.RegisterCommands<HackerGame>(joeServer);
slashCommands.[3].RegisterCommands<Store>(joeServer); sc4.RegisterCommands<Store>(joeServer);
slashCommands.[4].RegisterCommands<SlotMachine>(joeServer); sc5.RegisterCommands<SlotMachine>(joeServer);
// Degenz // Degenz
//slash.RegisterCommands<HackerGame>(922414052708327494uL); //slash.RegisterCommands<HackerGame>(922414052708327494uL);
@ -63,7 +66,7 @@ let run (client : DiscordClient) =
clients clients
|> Array.map run |> Array.map run
|> Array.toSeq |> Array.toSeq
|> Async.Parallel |> Async.Sequential
|> Async.RunSynchronously |> Async.RunSynchronously
|> ignore |> ignore

View File

@ -1,18 +0,0 @@
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["PlayerRegistration/PlayerRegistration.fsproj", "PlayerRegistration/"]
RUN dotnet restore "PlayerRegistration/PlayerRegistration.fsproj"
COPY . .
WORKDIR "/src/PlayerRegistration"
RUN dotnet build "PlayerRegistration.fsproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "PlayerRegistration.fsproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PlayerRegistration.dll"]

View File

@ -8,6 +8,6 @@ nuget FSharp.Core >= 6.0.0
source https://nuget.emzi0767.com/api/v3/index.json source https://nuget.emzi0767.com/api/v3/index.json
nuget DSharpPlus >= 4.2.0-nightly-01054 nuget DSharpPlus >= 4.2.0-nightly-01054
nuget DSharpPlus.SlashCommands >= 4.2.0-nightly-01054 nuget DSharpPlus.SlashCommands >= 4.2.0-nightly-01061
nuget MongoDB.Driver nuget MongoDB.Driver

View File

@ -468,7 +468,7 @@ NUGET
System.Runtime (>= 4.3) System.Runtime (>= 4.3)
System.ValueTuple (4.5) System.ValueTuple (4.5)
remote: https://nuget.emzi0767.com/api/v3/index.json remote: https://nuget.emzi0767.com/api/v3/index.json
DSharpPlus (4.2.0-nightly-01059) DSharpPlus (4.2.0-nightly-01061)
Emzi0767.Common (>= 2.6.2) Emzi0767.Common (>= 2.6.2)
Microsoft.Extensions.Logging.Abstractions (>= 5.0) Microsoft.Extensions.Logging.Abstractions (>= 5.0)
Newtonsoft.Json (>= 13.0.1) Newtonsoft.Json (>= 13.0.1)
@ -478,6 +478,6 @@ NUGET
System.Net.WebSockets.Client (>= 4.3.2) System.Net.WebSockets.Client (>= 4.3.2)
System.Runtime.InteropServices.RuntimeInformation (>= 4.3) System.Runtime.InteropServices.RuntimeInformation (>= 4.3)
System.Threading.Channels (>= 5.0) System.Threading.Channels (>= 5.0)
DSharpPlus.SlashCommands (4.2.0-nightly-01059) DSharpPlus.SlashCommands (4.2.0-nightly-01061)
DSharpPlus (>= 4.2.0-nightly-01059) DSharpPlus (>= 4.2.0-nightly-01061)
Microsoft.Extensions.DependencyInjection (>= 5.0.1) Microsoft.Extensions.DependencyInjection (>= 5.0.1)