# panel-native RuneScape: Dragonwilds runtime image.
#
# Dragonwilds ships a native-Linux UE5 build — no Wine. Minimal debian:12-slim
# + 32-bit runtime libs (steamclient.so dependency) + UE5 dlopen shim libs.
# Same scaffolding as the `rust` module; UE5 servers touch the same set of X/
# GL libs at boot even in headless mode.
#
# Expected runtime layout inside the container:
#   /game                                                  — SteamCMD install (panel volume)
#   /game/RSDragonwildsServer.sh                           — Jagex's launcher wrapper
#   /game/RSDragonwilds/Binaries/Linux/RSDragonwildsServer-Linux-Shipping — real exe
#   /game/RSDragonwilds/Saved/Config/LinuxServer/DedicatedServer.ini — operator config
#   /game-saves                                            — save + logs volume

FROM debian:12-slim

ENV DEBIAN_FRONTEND=noninteractive \
    TZ=Etc/UTC \
    LANG=en_US.UTF-8 \
    LC_ALL=en_US.UTF-8

RUN dpkg --add-architecture i386 \
 && apt-get update \
 && apt-get install -y --no-install-recommends \
    ca-certificates \
    locales \
    tini \
    curl \
    lib32gcc-s1 \
    lib32stdc++6 \
    libc6:i386 \
    libgl1 \
    libx11-6 \
    libxcursor1 \
    libxext6 \
    libxi6 \
    libxrandr2 \
    libxrender1 \
    procps \
 && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
 && locale-gen \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

RUN groupadd -g 1000 panel \
 && useradd -u 1000 -g 1000 -m -s /bin/bash panel \
 && mkdir -p /game /game-saves \
 && chown -R panel:panel /game /game-saves

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 7777/udp

ENTRYPOINT ["/usr/bin/tini", "--", "/entrypoint.sh"]
