Skip to content

Commit

Permalink
Merge pull request #73 from feserr/main
Browse files Browse the repository at this point in the history
Add support for ARM64 architecture
  • Loading branch information
arguser authored Nov 30, 2024
2 parents 4feea26 + a4cf29c commit fa9eaf4
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
id: docker_build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}

Expand Down
55 changes: 53 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
###########################################################
# Dockerfile that builds a Core Keeper Gameserver
###########################################################
FROM cm2network/steamcmd:root
FROM cm2network/steamcmd:root AS base-amd64
FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-11-24 AS base-arm64

ARG TARGETARCH
FROM base-${TARGETARCH}

LABEL maintainer="[email protected]"

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

RUN dpkg --add-architecture i386
ARG TARGETARCH
RUN case "${TARGETARCH}" in \
"amd64") dpkg --add-architecture i386 ;; \
esac

# Install Core Keeper server dependencies and clean up
RUN set -x \
Expand All @@ -27,13 +34,56 @@ RUN set -x \
gosu \
jo \
gettext-base \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN case "${TARGETARCH}" in \
"arm64") apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
libmonosgen-2.0-1 \
libdbus-1-3 \
libxcursor1 \
libxinerama1 \
libxss1 \
libatomic1 \
libpulse0 \
&& rm -rf /var/lib/apt/lists/* ;; \
esac

# Download Depot downloader
ARG DEPOT_DOWNLOADER_VERSION="2.7.4"
RUN case "${TARGETARCH}" in \
"amd64") DEPOT_DOWNLOADER_FILENAME=DepotDownloader-linux-x64.zip ;; \
"arm64") DEPOT_DOWNLOADER_FILENAME=DepotDownloader-linux-arm64.zip ;; \
esac \
&& wget --progress=dot:giga "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_${DEPOT_DOWNLOADER_VERSION}/${DEPOT_DOWNLOADER_FILENAME}" -O DepotDownloader.zip \
&& unzip DepotDownloader.zip \
&& rm -rf DepotDownloader.xml \
&& chmod +x DepotDownloader \
&& mv DepotDownloader /usr/local/bin/DepotDownloader

# Setup X11 Sockets folder
RUN mkdir /tmp/.X11-unix \
&& chmod 1777 /tmp/.X11-unix \
&& chown root /tmp/.X11-unix

# Box64/86 configuration
ENV BOX64_DYNAREC_BIGBLOCK=0 \
BOX64_DYNAREC_SAFEFLAGS=2 \
BOX64_DYNAREC_STRONGMEM=3 \
BOX64_DYNAREC_FASTROUND=0 \
BOX64_DYNAREC_FASTNAN=0 \
BOX64_DYNAREC_X87DOUBLE=1 \
BOX64_DYNAREC_BLEEDING_EDGE=0 \
BOX86_DYNAREC_BIGBLOCK=0 \
BOX86_DYNAREC_SAFEFLAGS=2 \
BOX86_DYNAREC_STRONGMEM=3 \
BOX86_DYNAREC_FASTROUND=0 \
BOX86_DYNAREC_FASTNAN=0 \
BOX86_DYNAREC_X87DOUBLE=1 \
BOX86_DYNAREC_BLEEDING_EDGE=0

# Setup folders
COPY ./scripts ${SCRIPTSDIR}
RUN set -x \
Expand All @@ -45,6 +95,7 @@ RUN set -x \
# Declare envs and their default values
ENV PUID=1000 \
PGID=1000 \
USE_DEPOT_DOWNLOADER=false \
WORLD_INDEX=0 \
WORLD_NAME="Core Keeper Server" \
WORLD_SEED=0 \
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ Explore an endless cavern of creatures, relics and resources in a mining sandbox

## How to run

### ARM based configuration

This image currently includes the following Box64 build variants for the following devices:

- Generic [generic]
- Raspberry Pi 5 [rpi5]
- M1 (M-Series) Mac [m1]
- ADLink Ampere Altra (Oracle ARM CPUs) [adlink]

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.

### Volumes

Create two directories where you want to run your server :
Expand Down Expand Up @@ -46,6 +57,8 @@ Create a `core.env` file, it should contain the environment variables for the de
```env
PUID=1000
PGID=1000
ARM64_DEVICE=generic
USE_DEPOT_DOWNLOADER=false
WORLD_INDEX=0
WORLD_NAME="Core Keeper Server"
WORLD_SEED=0
Expand Down Expand Up @@ -94,6 +107,8 @@ These are the arguments you can use to customize server behavior with default va
| :---: | :---: | :---: |
| PUID | 1000 | The user ID on the host that the container should use for file ownership and permissions. |
| PGID | 1000 | The group ID on the host that the container should use for file ownership and permissions. |
| ARM64_DEVICE | generic | The Box64 build variants. Accepts `generic`, `rpi5`, `m1` and `adlink`. |
| USE_DEPOT_DOWNLOADER | false | Use Depot downloader instead of steamcmd. Useful for system not compatible with 32 bits. |
| WORLD_INDEX | 0 | Which world index to use. |
| WORLD_NAME | "Core Keeper Server" | The name to use for the server. |
| WORLD_SEED | 0 | The seed to use for a new world. Set to 0 to generate random seed. |
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-example/core.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PUID=1000
PGID=1000
ARM64_DEVICE=adlink
USE_DEPOT_DOWNLOADER=false
WORLD_INDEX=0
WORLD_NAME="Core Keeper Server"
WORLD_SEED=0
Expand Down
2 changes: 2 additions & 0 deletions docker-compose-example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ services:
core-keeper:
container_name: core-keeper-dedicated
image: escaping/core-keeper-dedicated
ports:
- "$SERVER_PORT:$SERVER_PORT/udp"
volumes:
- server-files:/home/steam/core-keeper-dedicated
- server-data:/home/steam/core-keeper-data
Expand Down
9 changes: 8 additions & 1 deletion scripts/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ touch "$logfile"
Xvfb :99 -screen 0 1x1x24 -nolisten tcp &
xvfbpid=$!

# Get the architecture using dpkg
architecture=$(dpkg --print-architecture)

# Start Core Keeper Server
DISPLAY=:99 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${STEAMCMDDIR}/linux64/" ./CoreKeeperServer "${params[@]}" &
if [ "$architecture" == "arm64" ]; then
DISPLAY=:99 LD_LIBRARY_PATH="${STEAMCMDDIR}/linux64:${BOX64_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}" /usr/local/bin/box64 ./CoreKeeperServer "${params[@]}" &
else
DISPLAY=:99 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${STEAMCMDDIR}/linux64/" ./CoreKeeperServer "${params[@]}" &
fi
ckpid=$!

LogDebug "Started server process with pid ${ckpid}"
Expand Down
10 changes: 9 additions & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mkdir -p "${STEAMAPPDIR}" || true

# Initialize arguments array
args=(
"+@sSteamCmdForcePlatformType" "linux"
"+@sSteamCmdForcePlatformBitness" "64"
"+force_install_dir" "$STEAMAPPDIR"
"+login" "anonymous"
"+app_update" "$STEAMAPPID" "validate"
Expand All @@ -19,6 +21,12 @@ fi
args+=("+quit")

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

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

0 comments on commit fa9eaf4

Please sign in to comment.