Skip to content

Commit fa9eaf4

Browse files
authored
Merge pull request #73 from feserr/main
Add support for ARM64 architecture
2 parents 4feea26 + a4cf29c commit fa9eaf4

7 files changed

Lines changed: 90 additions & 5 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
id: docker_build
5151
uses: docker/build-push-action@v5
5252
with:
53-
platforms: linux/amd64
53+
platforms: linux/amd64,linux/arm64
5454
push: true
5555
tags: ${{ steps.meta.outputs.tags }}
5656

Dockerfile

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
###########################################################
22
# Dockerfile that builds a Core Keeper Gameserver
33
###########################################################
4-
FROM cm2network/steamcmd:root
4+
FROM cm2network/steamcmd:root AS base-amd64
5+
FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-11-24 AS base-arm64
6+
7+
ARG TARGETARCH
8+
FROM base-${TARGETARCH}
59

610
LABEL maintainer="leandro.martin@protonmail.com"
711

@@ -14,7 +18,10 @@ ENV SCRIPTSDIR="${HOMEDIR}/scripts"
1418
ENV MODSDIR="${STEAMAPPDATADIR}/StreamingAssets/Mods"
1519
ENV DLURL=https://raw.githubusercontent.com/escapingnetwork/core-keeper-dedicated
1620

17-
RUN dpkg --add-architecture i386
21+
ARG TARGETARCH
22+
RUN case "${TARGETARCH}" in \
23+
"amd64") dpkg --add-architecture i386 ;; \
24+
esac
1825

1926
# Install Core Keeper server dependencies and clean up
2027
RUN set -x \
@@ -27,13 +34,56 @@ RUN set -x \
2734
gosu \
2835
jo \
2936
gettext-base \
37+
unzip \
38+
wget \
3039
&& rm -rf /var/lib/apt/lists/*
3140

41+
RUN case "${TARGETARCH}" in \
42+
"arm64") apt-get update \
43+
&& apt-get install -y --no-install-recommends --no-install-suggests \
44+
libmonosgen-2.0-1 \
45+
libdbus-1-3 \
46+
libxcursor1 \
47+
libxinerama1 \
48+
libxss1 \
49+
libatomic1 \
50+
libpulse0 \
51+
&& rm -rf /var/lib/apt/lists/* ;; \
52+
esac
53+
54+
# Download Depot downloader
55+
ARG DEPOT_DOWNLOADER_VERSION="2.7.4"
56+
RUN case "${TARGETARCH}" in \
57+
"amd64") DEPOT_DOWNLOADER_FILENAME=DepotDownloader-linux-x64.zip ;; \
58+
"arm64") DEPOT_DOWNLOADER_FILENAME=DepotDownloader-linux-arm64.zip ;; \
59+
esac \
60+
&& wget --progress=dot:giga "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_${DEPOT_DOWNLOADER_VERSION}/${DEPOT_DOWNLOADER_FILENAME}" -O DepotDownloader.zip \
61+
&& unzip DepotDownloader.zip \
62+
&& rm -rf DepotDownloader.xml \
63+
&& chmod +x DepotDownloader \
64+
&& mv DepotDownloader /usr/local/bin/DepotDownloader
65+
3266
# Setup X11 Sockets folder
3367
RUN mkdir /tmp/.X11-unix \
3468
&& chmod 1777 /tmp/.X11-unix \
3569
&& chown root /tmp/.X11-unix
3670

71+
# Box64/86 configuration
72+
ENV BOX64_DYNAREC_BIGBLOCK=0 \
73+
BOX64_DYNAREC_SAFEFLAGS=2 \
74+
BOX64_DYNAREC_STRONGMEM=3 \
75+
BOX64_DYNAREC_FASTROUND=0 \
76+
BOX64_DYNAREC_FASTNAN=0 \
77+
BOX64_DYNAREC_X87DOUBLE=1 \
78+
BOX64_DYNAREC_BLEEDING_EDGE=0 \
79+
BOX86_DYNAREC_BIGBLOCK=0 \
80+
BOX86_DYNAREC_SAFEFLAGS=2 \
81+
BOX86_DYNAREC_STRONGMEM=3 \
82+
BOX86_DYNAREC_FASTROUND=0 \
83+
BOX86_DYNAREC_FASTNAN=0 \
84+
BOX86_DYNAREC_X87DOUBLE=1 \
85+
BOX86_DYNAREC_BLEEDING_EDGE=0
86+
3787
# Setup folders
3888
COPY ./scripts ${SCRIPTSDIR}
3989
RUN set -x \
@@ -45,6 +95,7 @@ RUN set -x \
4595
# Declare envs and their default values
4696
ENV PUID=1000 \
4797
PGID=1000 \
98+
USE_DEPOT_DOWNLOADER=false \
4899
WORLD_INDEX=0 \
49100
WORLD_NAME="Core Keeper Server" \
50101
WORLD_SEED=0 \

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ Explore an endless cavern of creatures, relics and resources in a mining sandbox
1111

1212
## How to run
1313

14+
### ARM based configuration
15+
16+
This image currently includes the following Box64 build variants for the following devices:
17+
18+
- Generic [generic]
19+
- Raspberry Pi 5 [rpi5]
20+
- M1 (M-Series) Mac [m1]
21+
- ADLink Ampere Altra (Oracle ARM CPUs) [adlink]
22+
23+
By default it is set to use `generic`. If you want to use another one, change the enviromental variable `ARM64_DEVICE` at the `core.env` file.
24+
1425
### Volumes
1526

1627
Create two directories where you want to run your server :
@@ -46,6 +57,8 @@ Create a `core.env` file, it should contain the environment variables for the de
4657
```env
4758
PUID=1000
4859
PGID=1000
60+
ARM64_DEVICE=generic
61+
USE_DEPOT_DOWNLOADER=false
4962
WORLD_INDEX=0
5063
WORLD_NAME="Core Keeper Server"
5164
WORLD_SEED=0
@@ -94,6 +107,8 @@ These are the arguments you can use to customize server behavior with default va
94107
| :---: | :---: | :---: |
95108
| PUID | 1000 | The user ID on the host that the container should use for file ownership and permissions. |
96109
| PGID | 1000 | The group ID on the host that the container should use for file ownership and permissions. |
110+
| ARM64_DEVICE | generic | The Box64 build variants. Accepts `generic`, `rpi5`, `m1` and `adlink`. |
111+
| USE_DEPOT_DOWNLOADER | false | Use Depot downloader instead of steamcmd. Useful for system not compatible with 32 bits. |
97112
| WORLD_INDEX | 0 | Which world index to use. |
98113
| WORLD_NAME | "Core Keeper Server" | The name to use for the server. |
99114
| WORLD_SEED | 0 | The seed to use for a new world. Set to 0 to generate random seed. |

docker-compose-example/core.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
PUID=1000
22
PGID=1000
3+
ARM64_DEVICE=adlink
4+
USE_DEPOT_DOWNLOADER=false
35
WORLD_INDEX=0
46
WORLD_NAME="Core Keeper Server"
57
WORLD_SEED=0

docker-compose-example/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ services:
22
core-keeper:
33
container_name: core-keeper-dedicated
44
image: escaping/core-keeper-dedicated
5+
ports:
6+
- "$SERVER_PORT:$SERVER_PORT/udp"
57
volumes:
68
- server-files:/home/steam/core-keeper-dedicated
79
- server-data:/home/steam/core-keeper-data

scripts/launch.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,15 @@ touch "$logfile"
3939
Xvfb :99 -screen 0 1x1x24 -nolisten tcp &
4040
xvfbpid=$!
4141

42+
# Get the architecture using dpkg
43+
architecture=$(dpkg --print-architecture)
44+
4245
# Start Core Keeper Server
43-
DISPLAY=:99 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${STEAMCMDDIR}/linux64/" ./CoreKeeperServer "${params[@]}" &
46+
if [ "$architecture" == "arm64" ]; then
47+
DISPLAY=:99 LD_LIBRARY_PATH="${STEAMCMDDIR}/linux64:${BOX64_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}" /usr/local/bin/box64 ./CoreKeeperServer "${params[@]}" &
48+
else
49+
DISPLAY=:99 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${STEAMCMDDIR}/linux64/" ./CoreKeeperServer "${params[@]}" &
50+
fi
4451
ckpid=$!
4552

4653
LogDebug "Started server process with pid ${ckpid}"

scripts/setup.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ mkdir -p "${STEAMAPPDIR}" || true
33

44
# Initialize arguments array
55
args=(
6+
"+@sSteamCmdForcePlatformType" "linux"
7+
"+@sSteamCmdForcePlatformBitness" "64"
68
"+force_install_dir" "$STEAMAPPDIR"
79
"+login" "anonymous"
810
"+app_update" "$STEAMAPPID" "validate"
@@ -19,6 +21,12 @@ fi
1921
args+=("+quit")
2022

2123
# Run SteamCMD with the arguments
22-
bash "${STEAMCMDDIR}/steamcmd.sh" "${args[@]}"
24+
if [ "${USE_DEPOT_DOWNLOADER}" == true ]; then
25+
DepotDownloader -app $STEAMAPPID -osarch 64 -dir $STEAMAPPDIR -validate
26+
DepotDownloader -app $STEAMAPPID_TOOL -osarch 64 -dir $STEAMAPPDIR -validate
27+
chmod +x $STEAMAPPDIR/CoreKeeperServer
28+
else
29+
"$STEAMCMDDIR/steamcmd.sh" "${args[@]}"
30+
fi
2331

2432
exec bash "${SCRIPTSDIR}/launch.sh"

0 commit comments

Comments
 (0)