Server build: the game without sound or controllers, so Linux servers need neither ALSA nor udev

horizon-client's cpal output and its controllers (gilrs, the DualSense's HID output) move behind the
audio and controllers features, on by default, so the game is unchanged. Built with
--no-default-features it links neither libasound.so.2 nor libudev.so.1. release.yml packages that
build as horizon-engine in horizon-server-linux-x86_64.tar.gz (xtask package-server, checked by
check_imports.py --server); install.sh installs it on Linux (and --archive installs a local one);
horizon-server already prefers horizon-engine. The Dockerfile uses it too, and CI lints it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-18 20:17:21 +02:00
parent 2a9d67bd68
commit 519ec1217c
14 changed files with 670 additions and 454 deletions
+5 -10
View File
@@ -13,20 +13,15 @@
# start writes /data/server.toml from HORIZON_* (EULA, WORLD, SEED, PORT, WHITELIST, PLAYERS, OP); later
# starts use the file. Manage it with `docker exec horizon horizon-server status|cmd|backup|logs ...`.
FROM rust:1-slim-bookworm AS build
RUN apt-get update \
&& apt-get install -y --no-install-recommends pkg-config libasound2-dev libudev-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
RUN cargo build --release --locked -p horizon-client --bin horizon-client -p horizon-server --bin horizon-server \
&& mkdir /out && cp target/release/horizon-client target/release/horizon-server /out/
# The server build of the game (no sound, no controllers: it needs neither ALSA nor udev) as horizon-engine.
RUN cargo build --release --locked -p horizon-client --no-default-features --bin horizon-client \
&& cargo build --release --locked -p horizon-server --bin horizon-server \
&& mkdir /out && cp target/release/horizon-client /out/horizon-engine && cp target/release/horizon-server /out/
FROM debian:bookworm-slim
# The game links ALSA and udev even when it runs headless with no sound.
RUN apt-get update \
&& apt-get install -y --no-install-recommends libasound2 libudev1 \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --system --home-dir /data --shell /usr/sbin/nologin horizon \
RUN useradd --system --home-dir /data --shell /usr/sbin/nologin horizon \
&& mkdir -p /data /opt/horizon/.local/horizon-client \
&& chown horizon:horizon /data
COPY --from=build /out/ /opt/horizon/