Skip to content

Commit

Permalink
Fix: Docker Compose (#336)
Browse files Browse the repository at this point in the history
* Fix: Docker Compose

* Update Maple2.Server.Game.csproj

* Update appsettings.json
  • Loading branch information
AngeloTadeucci authored Feb 27, 2025
1 parent 946d544 commit 1069635
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
**/values.dev.yaml
LICENSE
README.md
Maple2.File.Ingest\Resources
Maple2.File.Ingest/Resources
9 changes: 5 additions & 4 deletions Maple2.Server.Game/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ COPY ["Maple2.Tools/Maple2.Tools.csproj", "Maple2.Tools/"]
COPY ["Maple2.Model/Maple2.Model.csproj", "Maple2.Model/"]
COPY ["Maple2.Database/Maple2.Database.csproj", "Maple2.Database/"]
COPY ["Maple2.Server.Core/Maple2.Server.Core.csproj", "Maple2.Server.Core/"]
RUN dotnet restore -r win-x64 "Maple2.Server.Game/Maple2.Server.Game.csproj"
RUN dotnet restore "Maple2.Server.Game/Maple2.Server.Game.csproj"
COPY . .
WORKDIR "/src/Maple2.Server.Game"

FROM build AS publish
RUN dotnet publish -r win-x64 "Maple2.Server.Game.csproj" -c Debug
RUN dotnet publish "Maple2.Server.Game.csproj" -c Debug /p:IsDockerBuild=true

FROM base AS final
WORKDIR /app
COPY --from=publish /src/Maple2.Server.Game/bin/Debug/net8.0/win-x64/publish .
COPY --from=build /src/Maple2.File.Ingest/Navmeshes /Maple2.File.Ingest/Navmeshes
COPY --from=publish /src/Maple2.Server.Game/bin/Debug/net8.0/publish .
COPY --from=build /src/Maple2.Server.Game/Scripting/Scripts /app/Scripts
COPY --from=build /src/Maple2.Server.Game/Navmeshes /app/Navmeshes

ENTRYPOINT ["dotnet", "Maple2.Server.Game.dll"]
2 changes: 1 addition & 1 deletion Maple2.Server.Game/Manager/Field/Navigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Navigation(string name) {
}

private DtNavMesh LoadNavMesh() {
FileStream fs = new FileStream(System.IO.Path.Combine(Paths.NAVMESH_DIR, $"{Name}.navmesh"), FileMode.Open, FileAccess.Read);
FileStream fs = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Navmeshes", $"{Name}.navmesh"), FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
DtMeshSetReader reader = new DtMeshSetReader();

Expand Down
76 changes: 42 additions & 34 deletions Maple2.Server.Game/Maple2.Server.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,61 @@
<DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
<LangVersion>12</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<IsDockerBuild Condition="'$(IsDockerBuild)' == ''">false</IsDockerBuild>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DefineConstants>TRACE;TRIGGER_DEBUG</DefineConstants>
<DefineConstants>TRACE;TRIGGER_DEBUG</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Maple2.Database\Maple2.Database.csproj" />
<ProjectReference Include="..\Maple2.Server.Core\Maple2.Server.Core.csproj" />
<ProjectReference Include="..\Maple2.Database\Maple2.Database.csproj"/>
<ProjectReference Include="..\Maple2.Server.Core\Maple2.Server.Core.csproj"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.67.0" />
<PackageReference Include="Grpc.Net.Client" Version="2.67.0" />
<PackageReference Include="IronPython" Version="3.4.1" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0"/>
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.67.0"/>
<PackageReference Include="Grpc.Net.Client" Version="2.67.0"/>
<PackageReference Include="IronPython" Version="3.4.1"/>
<PackageReference Include="IronPython.StdLib" Version="3.4.1">
<!-- <ExcludeAssets>contentFiles</ExcludeAssets>-->
<!-- <ExcludeAssets>contentFiles</ExcludeAssets>-->
</PackageReference>
<PackageReference Include="Maple2.Lua" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Expressions" Version="3.4.1" />
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
<PackageReference Include="DijkstraAlgorithm" Version="1.1.0" />
<PackageReference Include="DotRecast.Core" Version="2024.2.3" />
<PackageReference Include="DotRecast.Detour" Version="2024.2.3" />
<PackageReference Include="DotRecast.Recast" Version="2024.2.3" />
<PackageReference Include="DotRecast.Recast.Toolset" Version="2024.2.3" />
<PackageReference Include="Maple2.Lua" Version="2.0.1"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0"/>
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0"/>
<PackageReference Include="Serilog.Expressions" Version="3.4.1"/>
<PackageReference Include="Serilog.Extensions.Logging" Version="7.0.0"/>
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.1"/>
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0"/>
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0"/>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1"/>
<PackageReference Include="DijkstraAlgorithm" Version="1.1.0"/>
<PackageReference Include="DotRecast.Core" Version="2024.2.3"/>
<PackageReference Include="DotRecast.Detour" Version="2024.2.3"/>
<PackageReference Include="DotRecast.Recast" Version="2024.2.3"/>
<PackageReference Include="DotRecast.Recast.Toolset" Version="2024.2.3"/>
</ItemGroup>

<ItemGroup Condition="'$(IsDockerBuild)' == 'true'">
<None Remove="Scripting\Scripts\Trigger\**\*.py"/>
<None Remove="Navmeshes\**\*.navmesh"/>
</ItemGroup>

<ItemGroup Condition="'$(IsDockerBuild)' != 'true'">
<None Update="Scripting\Scripts\Trigger\**\*.py">
<ParentDir>$([System.IO.Path]::GetFileName($([System.String]::Copy('%(RecursiveDir)').TrimEnd('\'))))\</ParentDir>
<TargetPath>Scripts\Trigger\%(ParentDir)\%(Filename)%(Extension)</TargetPath>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Navmeshes\**\*.navmesh">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Scripting\Scripts\Trigger\**\*.py">
<ParentDir>$([System.IO.Path]::GetFileName($([System.String]::Copy('%(RecursiveDir)').TrimEnd('\'))))\</ParentDir>
<TargetPath>Scripts\Trigger\%(ParentDir)\%(Filename)%(Extension)</TargetPath>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Scripting\Scripts\Trigger\trigger_api.py">
<TargetPath>Scripts\Trigger\trigger_api.py</TargetPath>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
8 changes: 5 additions & 3 deletions Maple2.Server.Login/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ COPY ["Maple2.Tools/Maple2.Tools.csproj", "Maple2.Tools/"]
COPY ["Maple2.Model/Maple2.Model.csproj", "Maple2.Model/"]
COPY ["Maple2.Database/Maple2.Database.csproj", "Maple2.Database/"]
COPY ["Maple2.Server.Core/Maple2.Server.Core.csproj", "Maple2.Server.Core/"]
RUN dotnet restore -r win-x64 "Maple2.Server.Login/Maple2.Server.Login.csproj"
RUN dotnet restore "Maple2.Server.Login/Maple2.Server.Login.csproj"
COPY . .
WORKDIR "/src/Maple2.Server.Login"

FROM build AS publish
RUN dotnet publish -r win-x64 "Maple2.Server.Login.csproj" -c Debug -o /app/publish
RUN dotnet publish "Maple2.Server.Login.csproj" -c Debug

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=publish /src/Maple2.Server.Login/bin/Debug/net8.0/publish .

ENTRYPOINT ["dotnet", "Maple2.Server.Login.dll"]
7 changes: 4 additions & 3 deletions Maple2.Server.Web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ COPY ["Maple2.Database/Maple2.Database.csproj", "Maple2.Database/"]
COPY ["Maple2.Server.Core/Maple2.Server.Core.csproj", "Maple2.Server.Core/"]
COPY ["Maple2.Model/Maple2.Model.csproj", "Maple2.Model/"]
COPY ["Maple2.Tools/Maple2.Tools.csproj", "Maple2.Tools/"]
RUN dotnet restore -r win-x64 "Maple2.Server.Web/Maple2.Server.Web.csproj"
RUN dotnet restore "Maple2.Server.Web/Maple2.Server.Web.csproj"
COPY . .
WORKDIR "/src/Maple2.Server.Web"

FROM build AS publish
RUN dotnet publish -r win-x64 "Maple2.Server.Web.csproj" -c Debug -o /app/publish
RUN dotnet publish "Maple2.Server.Web.csproj" -c Debug

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=publish /src/Maple2.Server.Web/bin/Debug/net8.0/publish .

ENTRYPOINT ["dotnet", "Maple2.Server.Web.dll"]
8 changes: 5 additions & 3 deletions Maple2.Server.World/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ COPY ["Maple2.Tools/Maple2.Tools.csproj", "Maple2.Tools/"]
COPY ["Maple2.Model/Maple2.Model.csproj", "Maple2.Model/"]
COPY ["Maple2.Database/Maple2.Database.csproj", "Maple2.Database/"]
COPY ["Maple2.Server.Core/Maple2.Server.Core.csproj", "Maple2.Server.Core/"]
RUN dotnet restore -r win-x64 "Maple2.Server.World/Maple2.Server.World.csproj"
RUN dotnet restore "Maple2.Server.World/Maple2.Server.World.csproj"
COPY . .
WORKDIR "/src/Maple2.Server.World"

FROM build AS publish
RUN dotnet publish -r win-x64 "Maple2.Server.World.csproj" -c Debug -o /app/publish
RUN dotnet publish "Maple2.Server.World.csproj" -c Debug

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=publish /src/Maple2.Server.World/bin/Debug/net8.0/publish .

ENTRYPOINT ["dotnet", "Maple2.Server.World.dll"]
2 changes: 2 additions & 0 deletions Maple2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
setup.bat = setup.bat
setup.ps1 = setup.ps1
start.bat = start.bat
.dockerignore = .dockerignore
compose.yml = compose.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Maple2.Server.DebugGame", "Maple2.Server.DebugGame\Maple2.Server.DebugGame.csproj", "{F0E28D7F-A88B-4DFE-BCA6-C36C18FBF269}"
Expand Down

0 comments on commit 1069635

Please sign in to comment.