From fac4d1265167b8d50ff657b455771ec0339d2029 Mon Sep 17 00:00:00 2001 From: Sehkah Date: Sat, 17 Jun 2023 19:51:55 +0200 Subject: [PATCH] Add a multi-stage Docker build for local development. --- .dockerignore | 16 +++ Arrowgene.Ddon.config.local_dev.json | 161 +++++++++++++++++++++++++++ Dockerfile | 26 +++++ docker-compose.yml | 26 +++++ 4 files changed, 229 insertions(+) create mode 100644 .dockerignore create mode 100644 Arrowgene.Ddon.config.local_dev.json create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..79d21e186 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +* +!Arrowgene.DragonsDogmaOnline.sln +!SetSourceRevision.targets +# This is required by projects which import the SetSourceRevision.targets command to add Git revision info. +# Not including it causes (ingoreable) errors to be thrown +#!.git/ +!Arrowgene.Ddon.Cli/ +!Arrowgene.Ddon.Client/ +!Arrowgene.Ddon.Database/ +!Arrowgene.Ddon.GameServer/ +!Arrowgene.Ddon.LoginServer/ +!Arrowgene.Ddon.Rpc/ +!Arrowgene.Ddon.Rpc.Web/ +!Arrowgene.Ddon.Server/ +!Arrowgene.Ddon.Shared/ +!Arrowgene.Ddon.WebServer/ diff --git a/Arrowgene.Ddon.config.local_dev.json b/Arrowgene.Ddon.config.local_dev.json new file mode 100644 index 000000000..631525115 --- /dev/null +++ b/Arrowgene.Ddon.config.local_dev.json @@ -0,0 +1,161 @@ +{ + "WebServerSetting": { + "PublicWebEndPoint": { + "IpAddress": "0.0.0.0", + "Port": 52099, + "IsHttps": false, + "HttpsCertPath": "", + "HttpsCertPw": "", + "SslProtocols": 0, + "DomainName": "" + }, + "WebSetting": { + "ServerHeader": "", + "WebEndpoints": [ + { + "IpAddress": "0.0.0.0", + "Port": 52099, + "IsHttps": false, + "HttpsCertPath": "", + "HttpsCertPw": "", + "SslProtocols": 0, + "DomainName": "" + } + ], + "WebFolder": "\/var\/ddon\/server\/Files\/www" + } + }, + "GameServerSetting": { + "ServerSetting": { + "Id": 10, + "Name": "Game", + "ListenIpAddress": "0.0.0.0", + "ServerPort": 52000, + "LogLevel": 0, + "LogUnknownPackets": true, + "LogOutgoingPackets": true, + "LogOutgoingPacketPayload": false, + "LogIncomingPackets": true, + "LogIncomingPacketPayload": false, + "LogIncomingPacketStructure": false, + "LogOutgoingPacketStructure": false, + "ServerSocketSettings": { + "Identity": "Game", + "MaxConnections": 100, + "NumSimultaneouslyWriteOperations": 100, + "BufferSize": 2000, + "Retries": 10, + "MaxUnitOfOrder": 1, + "MaxSimultaneousSendsPerClient": 1, + "SocketTimeoutSeconds": -1, + "SocketSettings": { + "Backlog": 5, + "DontFragment": true, + "DualMode": false, + "ExclusiveAddressUse": false, + "NoDelay": false, + "UseOnlyOverlappedIo": false, + "ReceiveBufferSize": 8192, + "ReceiveTimeout": 0, + "SendBufferSize": 8192, + "SendTimeout": 0, + "Ttl": 32, + "LingerEnabled": false, + "LingerTime": 30, + "SocketOptions": [ + { + "Level": "Socket", + "Name": 4, + "Value": false + } + ] + } + } + } + }, + "LoginServerSetting": { + "ServerSetting": { + "Id": 1, + "Name": "Login", + "ListenIpAddress": "0.0.0.0", + "ServerPort": 52100, + "LogLevel": 0, + "LogUnknownPackets": true, + "LogOutgoingPackets": true, + "LogOutgoingPacketPayload": false, + "LogIncomingPackets": true, + "LogIncomingPacketPayload": false, + "LogIncomingPacketStructure": false, + "LogOutgoingPacketStructure": false, + "ServerSocketSettings": { + "Identity": "Login", + "MaxConnections": 100, + "NumSimultaneouslyWriteOperations": 100, + "BufferSize": 2000, + "Retries": 10, + "MaxUnitOfOrder": 1, + "MaxSimultaneousSendsPerClient": 1, + "SocketTimeoutSeconds": -1, + "SocketSettings": { + "Backlog": 5, + "DontFragment": true, + "DualMode": false, + "ExclusiveAddressUse": false, + "NoDelay": false, + "UseOnlyOverlappedIo": false, + "ReceiveBufferSize": 8192, + "ReceiveTimeout": 0, + "SendBufferSize": 8192, + "SendTimeout": 0, + "Ttl": 32, + "LingerEnabled": false, + "LingerTime": 30, + "SocketOptions": [ + { + "Level": "Socket", + "Name": 4, + "Value": false + } + ] + } + } + }, + "AccountRequired": false, + "JobLevelMax": 65, + "ClanMemberMax": 100, + "CharacterNumMax": 4, + "EnableVisualEquip": true, + "FriendListMax": 200, + "NoOperationTimeOutTime": 14400, + "UrlApiA": "http:\/\/localhost:52099\/link\/api", + "UrlApiB": "http:\/\/localhost:52099\/link\/api", + "UrlCampaign": "http:\/\/localhost:52099\/sp_ingame\/campaign\/bnr\/slide.html", + "UrlCampaignBanner": "http:\/\/localhost:52099\/sp_ingame\/campaign\/bnr\/bnr01.html?", + "UrlChargeA": "http:\/\/localhost:52099\/sp_ingame\/charge\/", + "UrlChargeB": "http:\/\/localhost:52099\/sp_ingame\/charge\/", + "UrlChargeCallback": "http:\/\/localhost:52099\/opening\/entry\/ddo\/cog_callback\/charge", + "UrlCompanionImage": "http:\/\/localhost:52099\/", + "UrlIndex": "http:\/\/localhost:52099\/sp_ingame\/link\/index.html", + "UrlManual": "http:\/\/localhost:52099\/manual_nfb\/", + "UrlPhotoupAuthorize": "http:\/\/localhost:52099\/api\/photoup\/authorize", + "UrlSample10": "http:\/\/sample10.html", + "UrlSample9": "http:\/\/sample09.html", + "UrlShopAttention": "http:\/\/localhost:52099\/shop\/ingame\/attention?", + "UrlShopCounterA": "http:\/\/localhost:52099\/shop\/ingame\/counter?", + "UrlShopCounterB": "http:\/\/localhost:52099\/shop\/ingame\/counter?", + "UrlShopDetail": "http:\/\/localhost:52099\/shop\/ingame\/stone\/detail", + "UrlShopStoneLimit": "http:\/\/localhost:52099\/shop\/ingame\/stone\/limit", + "UrlSupportIndex": "http:\/\/localhost:52099\/sp_ingame\/support\/index.html" + }, + "DatabaseSetting": { + "Type": 0, + "SqLiteFolder": "\/var\/ddon\/server\/Files\/Database", + "Host": "localhost", + "Port": 3306, + "User": "", + "Password": "", + "Database": "Ddon", + "WipeOnStartup": false + }, + "AssetPath": "\/var\/ddon\/server\/Files\/Assets" +} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..2adf609b8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env +WORKDIR /App +COPY . ./ + +RUN dotnet publish Arrowgene.Ddon.Cli/Arrowgene.Ddon.Cli.csproj /p:Version=1.0.0.0 -p:PublishReadyToRun=true /p:DebugType=None /p:DebugSymbols=false -r linux-x64 --self-contained false -c Release -o out + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 +#RUN apt-get update && apt-get install -y apt-transport-https && rm -rf /var/lib/apt/lists/* + +# Database +EXPOSE 3306/tcp +# Game server +EXPOSE 52000/tcp +# Web server +EXPOSE 52099/tcp +# Login server +EXPOSE 52100/tcp +ENV DOTNET_EnableDiagnostics=0 + +WORKDIR /var/ddon/server +COPY --from=build-env /App/out . +RUN adduser --disabled-password --gecos "" ddon_server +RUN chown -R ddon_server:ddon_server . +USER ddon_server + +CMD ["/var/ddon/server/Arrowgene.Ddon.Cli", "server", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..8ffd66331 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3.8' + +volumes: + ddon-server-database-volume: + +services: + app: + container_name: ddon-server + build: . + restart: no + ports: + # Database + - '3306:3306' + # Game server + - '52000:52000' + # Web server + - '52099:52099' + # Login server + - '52100:52100' + volumes: + - ddon-server-database-volume:/var/ddon/server/Files/Database + - ./Arrowgene.Ddon.config.local_dev.json:/var/ddon/server/Files/Arrowgene.Ddon.config.json:ro + - ./Arrowgene.Ddon.Shared/Files/Assets:/var/ddon/server/Files/Assets:ro + # Workaround: cli expects to be able to process keyboard input + tty: true + command: /var/ddon/server/Arrowgene.Ddon.Cli server start