diff --git a/games/arma3/Dockerfile b/games/arma3/Dockerfile index 49ec2a8..428b7d2 100644 --- a/games/arma3/Dockerfile +++ b/games/arma3/Dockerfile @@ -1,29 +1,51 @@ -FROM ubuntu:20.04 +FROM --platform=$BUILDPLATFORM debian:stable-slim LABEL author="David Wolfe (Red-Thirten)" maintainer="rehlmgaming@gmail.com" -ENV DEBIAN_FRONTEND noninteractive -ENV USER_NAME container -ENV NSS_WRAPPER_PASSWD /tmp/passwd -ENV NSS_WRAPPER_GROUP /tmp/group -# Install Dependencies +LABEL org.opencontainers.image.source="https://github.com/parkervcp/yolks" +LABEL org.opencontainers.image.licenses=MIT + +## Update base packages and install dependencies +ENV DEBIAN_FRONTEND=noninteractive RUN dpkg --add-architecture i386 \ && apt-get update \ && apt-get upgrade -y \ - && apt-get install -y libgcc-10-dev libstdc++-10-dev libtinfo5 lib64z1 libcurl3-gnutls \ - && apt-get install -y libnss-wrapper gettext-base tar curl gcc g++ libc6 libtbb2 lib32z1 lib32gcc1 lib32stdc++6 libsdl2-2.0-0 libsdl2-2.0-0:i386 libtbb2:i386 lib32stdc++6 libtinfo5:i386 libncurses5:i386 libcurl3-gnutls:i386 tzdata \ - && useradd -m -d /home/container -s /bin/bash container \ - && touch ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \ + && apt-get install -y \ + curl \ + tzdata \ + locales \ + iproute2 \ + gettext-base \ + ca-certificates \ + libssl-dev \ + lib32gcc-s1 \ + libsdl2-2.0-0 \ + libsdl2-2.0-0:i386 \ + libstdc++6 \ + libstdc++6:i386 \ + lib32stdc++6 \ + libnss-wrapper \ + libnss-wrapper:i386 \ + libtbb2 \ + libtbb2:i386 + +## Configure locale +RUN update-locale lang=en_US.UTF-8 \ + && dpkg-reconfigure --frontend noninteractive locales + +## Prepare NSS Wrapper for the entrypoint as a workaround for Arma 3 requiring a valid UID +ENV NSS_WRAPPER_PASSWD=/tmp/passwd NSS_WRAPPER_GROUP=/tmp/group +RUN touch ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \ && chgrp 0 ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} \ && chmod g+rw ${NSS_WRAPPER_PASSWD} ${NSS_WRAPPER_GROUP} - ADD passwd.template /passwd.template +## Setup user and working directory +RUN useradd -m -d /home/container -s /bin/bash container USER container -ENV HOME /home/container +ENV USER=container HOME=/home/container WORKDIR /home/container -COPY ./libnss_wrapper.so /libnss_wrapper.so -COPY ./libnss_wrapper_x64.so /libnss_wrapper_x64.so +## Copy over and execute entrypoint.sh COPY ./entrypoint.sh /entrypoint.sh -CMD ["/bin/bash", "/entrypoint.sh"] +CMD [ "/bin/bash", "/entrypoint.sh" ] diff --git a/games/arma3/entrypoint.sh b/games/arma3/entrypoint.sh index d01b9a4..b9925d4 100644 --- a/games/arma3/entrypoint.sh +++ b/games/arma3/entrypoint.sh @@ -2,8 +2,8 @@ ## File: Pterodactyl Arma 3 Image - entrypoint.sh ## Author: David Wolfe (Red-Thirten) -## Contributors: Aussie Server Hosts (https://aussieserverhosts.com/) -## Date: 2021/07/13 +## Contributors: Aussie Server Hosts (https://aussieserverhosts.com/), Stephen White (SilK) +## Date: 2022/05/22 ## License: MIT License ## === CONSTANTS === @@ -167,12 +167,15 @@ function RemoveDuplicates { #[Input: str - Output: printf of new str] # === ENTRYPOINT START === +# Wait for the container to fully initialize +sleep 1 + # Set environment variable that holds the Internal Docker IP INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') export INTERNAL_IP -cd /home/container -sleep 1 +# Switch to the container's working directory +cd /home/container || exit 1 # Check for old eggs if [[ -z ${VALIDATE_SERVER} ]]; then # VALIDATE_SERVER was not in the previous version @@ -350,15 +353,15 @@ if [[ ! -f ./basic.cfg ]]; then curl -sSL ${BASIC_URL} -o ./basic.cfg fi -# $NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile +# Setup NSS Wrapper for use ($NSS_WRAPPER_PASSWD and $NSS_WRAPPER_GROUP have been set by the Dockerfile) export USER_ID=$(id -u) export GROUP_ID=$(id -g) envsubst < /passwd.template > ${NSS_WRAPPER_PASSWD} -if [[ ${SERVER_BINARY} == *"x64"* ]]; then # Check which libnss_wrapper architecture to run, based off the server binary name - export LD_PRELOAD=/libnss_wrapper_x64.so +if [[ ${SERVER_BINARY} == *"x64"* ]]; then # Check which libnss-wrapper architecture to run, based off the server binary name + export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libnss_wrapper.so else - export LD_PRELOAD=/libnss_wrapper.so + export LD_PRELOAD=/usr/lib/i386-linux-gnu/libnss_wrapper.so fi # Replace Startup Variables diff --git a/games/arma3/libnss_wrapper.so b/games/arma3/libnss_wrapper.so deleted file mode 100644 index 8f32e83..0000000 Binary files a/games/arma3/libnss_wrapper.so and /dev/null differ diff --git a/games/arma3/libnss_wrapper_x64.so b/games/arma3/libnss_wrapper_x64.so deleted file mode 100644 index 8f7438a..0000000 Binary files a/games/arma3/libnss_wrapper_x64.so and /dev/null differ diff --git a/games/arma3/passwd.template b/games/arma3/passwd.template index ace1d78..2b0dd45 100644 --- a/games/arma3/passwd.template +++ b/games/arma3/passwd.template @@ -23,4 +23,4 @@ systemd-bus-proxy:x:103:105:systemd Bus Proxy,,,:/run/systemd:/bin/false syslog:x:104:108::/home/syslog:/bin/false messagebus:x:106:109::/var/run/dbus:/bin/false bind:x:108:112::/var/cache/bind:/bin/false -${USER_NAME}:x:${USER_ID}:${GROUP_ID}:${USER_NAME}:${HOME}:/bin/bash \ No newline at end of file +${USER}:x:${USER_ID}:${GROUP_ID}:${USER}:${HOME}:/bin/bash \ No newline at end of file