Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: basic Docker support #2040

Closed
wants to merge 12 commits into from
44 changes: 44 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Distribution Files
/Distribution/ModernUO
/Distribution/ModernUO.*
/Distribution/Server
/Distribution/Server.*
/Distribution/Assemblies
/Distribution/bsdtar
/Distribution/Configuration/antimacro.json
/Distribution/Configuration/assistants.json
/Distribution/Configuration/expansion.json
/Distribution/Configuration/modernuo.json
/Distribution/Configuration/email-settings.json
/Distribution/Configuration/throttles.json
/Distribution/Configuration/tot.json
/Distribution/Logs
/Distribution/Archives
/Distribution/Backups
/Distribution/Saves
/Distribution/docs
/Distribution/temp
/Distribution/*.dylib
/Distribution/*.so
/Distribution/*.dll
/Distribution/*.exe
/Distribution/runtimes
/Distribution/nohup.out
/Distribution/ref
/Distribution/web

/Projects/*/obj
/Projects/*/bin
/Projects/*/Generated

*.swp
*.log
*.user
/.idea
/.vs
/.vscode

.DS_Store

/packages/*
/Distribution/Configuration/server-access.json
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# syntax=docker.io/docker/dockerfile:1.7-labs
ARG DOTNET_VERSION=9.0.101
ARG OS=linux
ARG ARCH=x64

FROM ubuntu:24.10 AS dependencies
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arbitrary base image

ARG DOTNET_VERSION
ARG ARCH
ARG OS

RUN apt-get update -y \
&& apt-get install -y libicu-dev curl

RUN curl -L https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh -o dotnet-install.sh && \
chmod +x dotnet-install.sh && \
./dotnet-install.sh --version ${DOTNET_VERSION} --architecture ${ARCH} --os ${OS}

ENV PATH $PATH:/root/.dotnet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have to update the PATH here so the publish stage can run the dotnet commands it needs to run


FROM dependencies AS publish
ARG OS
ARG ARCH

WORKDIR /bin/modernuo

COPY . .

RUN ./publish.sh release ${OS} ${ARCH}

FROM dependencies AS deploy
ARG DOTNET_VERSION
ARG ARCH

ENV DOTNET_ROOT=/root/.dotnet
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating the PATH in the dependencies stage above doesn't enable the ModernUO binary to find that installation

instead, we have to set DOTNET_ROOT before we run the binary


RUN apt-get update -y \
&& apt-get install -y \
libdeflate-dev zstd libargon2-dev

WORKDIR /bin/modernuo

COPY --from=publish /bin/modernuo/Distribution /bin/modernuo

CMD '/bin/modernuo/ModernUO'
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
modernuo:
build:
context: .
args:
OS: "${OS:-linux}"
ARCH: "${ARCH:-amd64}"
environment:
UO_DIRECTORY: ${UO_DIRECTORY:-/bin/UO}
ports:
- "2593:2593"
- "12000:12000"
volumes:
- "./Distribution/Saves:/bin/modernuo/Saves"
- "./Distribution/Configuration:/bin/modernuo/Configuration"
- "$UO_DIRECTORY:$UO_DIRECTORY"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr my UO directory is something like /Users/icculusc/Downloads/UO, so that's what it is in the modernuo.json from running it on the metal, this maps it directly to that directory, this is a bad solution to be fair

Loading