-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
base: main
Are you sure you want to change the base?
Changes from all commits
826f07d
49c806c
3459ddd
db79dab
d855c00
67080e9
a39b0d6
0d66424
27cff38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
## Getting Started | ||
|
||
Disclaimer: This document assumes familiarity with running containerized workloads. | ||
|
||
### Build | ||
|
||
```shell | ||
# linux/amd64 | ||
docker build -t modernuo/modernuo . | ||
|
||
# linux/arm64 | ||
docker build --build-arg ARCH=arm64 -t modernuo/modernuo . | ||
``` | ||
|
||
Note: `docker buildx` is capable of building for `amd64` on `arm64` machines (and other combinations), but that beyond the scope of this document. | ||
|
||
### Run | ||
|
||
In order to run the image as a container you need to provide three volume mounts: | ||
1. Save files, or an empty directory in which to save the game server. | ||
1. Configuration files, or an empty directory in which to save the configurations. | ||
1. Data files, from the Data directory in the repository | ||
1. UO files. | ||
|
||
In the following example we make three assumptions: | ||
1. UO files are located on the host machine at the path `/some/UO/place`. | ||
1. The `dataDirectories` array in `Configuration/modernuo.json` includes `/bin/UO`. | ||
1. The `docker run` command is being executed in the root of the repository. | ||
|
||
```shell | ||
docker run \ | ||
--volume $(pwd)/Distribution/Configuration:/bin/modernuo/Configuration \ | ||
--volume $(pwd)/Distribution/Data:/bin/modernuo/Data \ | ||
--volume $(pwd)/Distribution/Saves:/bin/modernuo/Saves \ | ||
--volume /some/UO/place:/bin/UO \ | ||
--expose 2593 \ | ||
modernuo/modernuo:latest | ||
``` | ||
|
||
#### Empty `Configuration` Directory | ||
|
||
If mounting an empty directory to the `Configuration` directory, use the following command instead. This variation will allow user input. This is required for initial configuration with an empty directory. In subsequent runs the above command should suffice. | ||
|
||
```shell | ||
docker run \ | ||
-it \ | ||
--volume $(pwd)/Distribution/Configuration:/bin/modernuo/Configuration \ | ||
--volume $(pwd)/Distribution/Data:/bin/modernuo/Data \ | ||
--volume $(pwd)/Distribution/Saves:/bin/modernuo/Saves \ | ||
--volume /some/UO/place:/bin/UO \ | ||
--expose 2593 \ | ||
modernuo/modernuo:latest | ||
``` | ||
Note: the volume is still required for the game data directory, the configuration affects the component that is `/bin/UO` in the example. | ||
|
||
### Connect | ||
|
||
Connect to the shard at `127.0.0.1:2593`. |
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 | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have to update the |
||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updating the instead, we have to set |
||
|
||
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' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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/Configuration:/bin/modernuo/Configuration" | ||
- "./Distribution/Data:/bin/modernuo/Data" | ||
- "./Distribution/Saves:/bin/modernuo/Saves" | ||
# see the example in the DOCKER.md file to understand this volume | ||
- "$UO_DIRECTORY:/bin/UO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arbitrary base image