# panel-native DayZ runtime image.
#
# DayZ ships a native Linux binary (SteamCMD app 223350). No Wine. The
# binary is a static-ish x86_64 ELF that pulls in the usual i386 pile
# (steamclient.so is 32-bit) + a couple of Bohemia's own shared libs
# that live under <install>/.
#
# Expected runtime layout inside the container:
#   /game                       — SteamCMD-installed DayZ Server
#   /game/DayZServer            — server binary (Bohemia's launcher wrapper)
#   /game/serverDZ.cfg          — primary config file (symlinked to /game-saves)
#   /game/battleye/             — BattlEye config + beserver.cfg (RCON port + pw)
#   /game/profiles              — logs, bans, RPT crash dumps (symlinked to /game-saves)
#   /game-saves/                — operator data volume (configs, profiles, world DB)

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 \
    libcurl4 \
    libxml2 \
    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 2302/udp 2303/udp 2304/udp 2305/udp

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