Arma 3 Image Cleanup & Refurbishment
Files: - Remove dependency of having `libnss_wrapper.so` libraries directly in the image. Instead, use the libraries provided with their respective packages. This fixes the current 32-bit version being broken and ensures the libraries stay up to date with their respective packages. - Slight change to passwd.template to accommodate variable name change. Dockerfile: - Change the base image to Debian, which from testing appears to run cleaner and faster for Arma. It also should yield a smaller image. - Fix depreciated `ENV` call format. - Removed un-needed packages. - Added iproute2 package. - Consolidated the NSS Wrapper setup to a commented group of lines to make understanding it's purpose and setup more clear. - Added shell flag to `useradd` command. Entrypoint: - General cleanup. - Changed `LD_PRELOAD`s to point to package-provided library file locations.
This commit is contained in:
@@ -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" ]
|
||||
|
@@ -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
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
${USER}:x:${USER_ID}:${GROUP_ID}:${USER}:${HOME}:/bin/bash
|
Reference in New Issue
Block a user