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:
Red-Thirten
2022-05-22 17:35:03 -07:00
parent cc7a9d0da5
commit e750a642c9
5 changed files with 49 additions and 24 deletions

View File

@@ -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" ]