Skip to content

Commit

Permalink
Add a multi-stage Docker build for local development.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sehkah committed Jun 17, 2023
1 parent 423db62 commit fac4d12
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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/
161 changes: 161 additions & 0 deletions Arrowgene.Ddon.config.local_dev.json
Original file line number Diff line number Diff line change
@@ -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"
}
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fac4d12

Please sign in to comment.