-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
198 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#### Build #### | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0.303@sha256:7d0ba26469267b563120456557e38eccef9972cb6b9cfbbd47a50d1218fa7b30 AS build | ||
WORKDIR /app | ||
|
||
COPY src/Directory.Build.props . | ||
COPY .editorconfig . | ||
COPY src/Worms.Armageddon.Game/Worms.Armageddon.Game.csproj ./src/Worms.Armageddon.Game/Worms.Armageddon.Game.csproj | ||
COPY src/Worms.Hub.ReplayProcessor/Worms.Hub.ReplayProcessor.csproj ./src/Worms.Hub.ReplayProcessor/Worms.Hub.ReplayProcessor.csproj | ||
RUN dotnet restore src/Worms.Hub.ReplayProcessor/Worms.Hub.ReplayProcessor.csproj | ||
|
||
COPY src/Worms.Armageddon.Game ./src/Worms.Armageddon.Game | ||
COPY src/Worms.Hub.ReplayProcessor ./src/Worms.Hub.ReplayProcessor | ||
ARG VERSION=0.0.1 | ||
RUN dotnet publish \ | ||
src/Worms.Hub.ReplayProcessor/Worms.Hub.ReplayProcessor.csproj \ | ||
-c Release \ | ||
-o out \ | ||
--no-restore \ | ||
-p:AssemblyVersion=${VERSION} \ | ||
-p:Version=${VERSION} | ||
|
||
#### Test #### | ||
FROM build AS test | ||
RUN dotnet test --no-restore --no-build --verbosity normal | ||
|
||
#### Runtime #### | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
wget \ | ||
p7zip-full \ | ||
unshield \ | ||
dotnet-runtime-8.0 | ||
|
||
# Get key to Wine repo | ||
RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key -O /tmp/winehq.key | ||
|
||
# Add Wine repo | ||
RUN apt-get update \ | ||
&& apt-get install -y software-properties-common gnupg \ | ||
&& apt-key add /tmp/winehq.key \ | ||
&& add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ jammy main' \ | ||
&& rm /tmp/winehq.key | ||
|
||
# AMD 32-bit deps for Wine | ||
RUN dpkg --add-architecture i386 \ | ||
&& apt-get update \ | ||
&& apt-get install -y --install-recommends winehq-stable wine32 xvfb \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create WINEPREFIX | ||
RUN WINEDLLOVERRIDES="mscoree,mshtml=" xvfb-run wineboot -i \ | ||
&& wineserver -k | ||
|
||
# Copy game installation directory | ||
|
||
# Some settings for WA | ||
RUN wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v WineCompatibilitySuggested /d 0x7FFFFFFF /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v WindowedMode /d 0x00000001 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v ChatPinned /d 0x00000001 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v DetailLevel /d 0x00000005 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v WindowedMode /d 0x00000001 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v PinnedChatLines /d 0x00000007 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v InfoTransparency /d 0x00000001 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v InfoSpy /d 0x00000001 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v DisableSmoothBackgroundGradient /d 0x00000000 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v HardwareRendering /d 0x00000001 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v LargerFonts /d 0x00000000 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v AssistedVsync /d 0x00000000 /f \ | ||
&& wine reg add 'HKEY_CURRENT_USER\Software\Team17SoftwareLTD\WormsArmageddon\Options' /t REG_DWORD /v Vsync /d 0x00000000 /f \ | ||
&& wineserver -k | ||
|
||
RUN Xvfb :1 & export DISPLAY=:1 | ||
|
||
WORKDIR /app | ||
COPY --from=build /app/out . | ||
ENTRYPOINT ["./Worms.Hub.ReplayProcessor"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Ignore everything | ||
** | ||
|
||
# Except for these files | ||
!/src | ||
!/scripts | ||
!.editorconfig | ||
|
||
**/bin | ||
**/obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
replay-processor_IMAGE_NAME := theeadie/worms-hub-replay-processor | ||
replay-processor_NEXT_VERSION := 0.1 | ||
replay-processor_TAG_PREFIX := replay-processor/v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Worms.Armageddon.Game; | ||
using Worms.Armageddon.Game.Replays; | ||
|
||
Console.WriteLine("Starting replay processor..."); | ||
|
||
var serviceCollection = new ServiceCollection().AddWormsArmageddonGameServices(); | ||
var serviceProvider = serviceCollection.BuildServiceProvider(); | ||
|
||
var gameLocator = serviceProvider.GetService<IWormsLocator>(); | ||
var logGenerator = serviceProvider.GetService<IReplayFrameExtractor>(); | ||
|
||
// Get message from queue | ||
// Grab the replay path from the message | ||
var replayPath = args[0]; | ||
var userHomeDirectory = Environment.GetEnvironmentVariable("HOME"); | ||
// Generate the replay log and save it | ||
var gameInfo = gameLocator!.Find(); | ||
|
||
if (gameInfo.IsInstalled) | ||
{ | ||
Console.WriteLine("Game found at: {0}", gameInfo.ExeLocation); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Looking in {0}", userHomeDirectory); | ||
Console.WriteLine("Game not found. Please install the game and try again."); | ||
return; | ||
} | ||
|
||
// Set the DISPLAY environment variable | ||
Environment.SetEnvironmentVariable("DISPLAY", ":99"); | ||
|
||
// Print the DISPLAY environment variable | ||
Console.WriteLine("DISPLAY: {0}", Environment.GetEnvironmentVariable("DISPLAY")); | ||
|
||
await logGenerator!.ExtractReplayFrames(replayPath, 5, TimeSpan.Zero, TimeSpan.FromSeconds(5)).ConfigureAwait(false); | ||
|
||
Console.WriteLine("Replay processor finished."); |
18 changes: 18 additions & 0 deletions
18
src/Worms.Hub.ReplayProcessor/Worms.Hub.ReplayProcessor.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Worms.Armageddon.Game\Worms.Armageddon.Game.csproj"/> | ||
</ItemGroup> | ||
|
||
</Project> |