This repository has been archived on 2023-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
steam-container/Dockerfile

43 lines
1.9 KiB
Docker

FROM archlinux:latest
LABEL Description="This image is based on Archlinux and is used for running game servers with SteamCMD" \
Author="david@socialnerds.org" \
Version="0.1" \
License="MIT"
# WORKAROUND for glibc 2.33 and old Docker
# See https://github.com/actions/virtual-environments/issues/2658
# Thanks to https://github.com/lxqt/lxqt-panel/pull/1562
RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \
curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \
bsdtar -C / -xvf "$patched_glibc" && \
echo "IgnorePkg = glibc lib32-glibc" >> /etc/pacman.conf
ENV USER_ID=1000
ENV GROUP_ID=1000
ENV USERNAME=steam
VOLUME [ "/home/${USERNAME}" ]
RUN pacman -Syu --noconfirm && \
pacman -S --noconfirm --needed base-devel openssh git sudo cargo tmux screen vim wget python unzip bc jq netcat nano && \
groupadd -g ${GROUP_ID} ${USERNAME} && \
useradd -u ${USER_ID} -g ${GROUP_ID} -M -d /home/${USERNAME} -s /bin/bash ${USERNAME} && \
chown ${USER_ID}:${GROUP_ID} /home/${USERNAME} && \
echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
cd /tmp && sudo -u ${USERNAME} git clone https://aur.archlinux.org/paru.git && cd paru && \
sudo -u ${USERNAME} makepkg -si --noconfirm && \
sudo -u ${USERNAME} paru -S --noconfirm steamcmd bsdmainutils && \
echo "HostKey /home/${USERNAME}/.ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config && \
echo "HostKey /home/${USERNAME}/.ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config && \
echo "HostKey /home/${USERNAME}/.ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config && \
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config && \
echo "PermitRootLogin no" >> /etc/ssh/sshd_config && \
echo "PidFile /home/${USERNAME}/.ssh/sshd.pid" >> /etc/ssh/sshd_config
USER ${USERNAME}
WORKDIR /home/${USERNAME}
COPY entrypoint.sh /opt/
CMD /opt/entrypoint.sh