You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
4.0 KiB
137 lines
4.0 KiB
#
|
|
# LinuxGSM Base Dockerfile
|
|
#
|
|
# https://github.com/GameServerManagers/docker-linuxgsm
|
|
#
|
|
|
|
FROM gameservermanagers/steamcmd:ubuntu-18.04
|
|
|
|
LABEL maintainer="LinuxGSM <[email protected]>"
|
|
ARG S6_OVERLAY_VERSION=3.1.2.1
|
|
ARG OVERLAY_ARCH="amd64"
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
ENV TERM=xterm
|
|
ENV LGSM_GITHUBUSER=GameServerManagers
|
|
ENV LGSM_GITHUBREPO=LinuxGSM
|
|
ENV LGSM_GITHUBBRANCH=develop
|
|
ENV GAMESERVER=jc3server
|
|
ENV UPDATE_CHECK=1800
|
|
ENV USERNAME=linuxgsm
|
|
ENV UID=1000
|
|
ENV GID=1000
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
## Install Base LinuxGSM Requirements
|
|
RUN echo "**** Install Base LinuxGSM Requirements ****" \
|
|
&& apt-get update \
|
|
&& apt-get install -y software-properties-common \
|
|
&& add-apt-repository multiverse \
|
|
&& add-apt-repository ppa:git-core/ppa \
|
|
&& apt-get update \
|
|
&& apt-get install -y \
|
|
cron \
|
|
bc \
|
|
binutils \
|
|
bsdmainutils \
|
|
bzip2 \
|
|
ca-certificates \
|
|
cpio \
|
|
curl \
|
|
distro-info \
|
|
file \
|
|
git \
|
|
gzip \
|
|
hostname \
|
|
jq \
|
|
lib32gcc-s1 \
|
|
lib32stdc++6 \
|
|
netcat \
|
|
python3 \
|
|
sudo \
|
|
tar \
|
|
tmux \
|
|
unzip \
|
|
util-linux \
|
|
wget \
|
|
xz-utils \
|
|
# Docker Extras
|
|
iproute2 \
|
|
iputils-ping \
|
|
nano \
|
|
vim \
|
|
&& apt-get -y autoremove \
|
|
&& apt-get -y clean \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& rm -rf /tmp/* \
|
|
&& rm -rf /var/tmp/*
|
|
|
|
# Install Node.js
|
|
RUN echo "**** Install Node.js ****" \
|
|
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
|
&& apt-get update \
|
|
&& apt-get install -y nodejs \
|
|
&& apt-get -y autoremove \
|
|
&& apt-get -y clean \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& rm -rf /tmp/* \
|
|
&& rm -rf /var/tmp/*
|
|
|
|
# Install GameDig https://docs.linuxgsm.com/requirements/gamedig
|
|
RUN echo "**** Install GameDig ****" \
|
|
&& npm install -g gamedig
|
|
|
|
# Install s6 overlay
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
|
|
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
|
|
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
|
|
|
|
RUN date > /build-time.txt
|
|
|
|
WORKDIR /linuxgsm
|
|
|
|
COPY entrypoint.sh /linuxgsm/entrypoint.sh
|
|
|
|
## Add linuxgsm user
|
|
RUN echo "**** Add linuxgsm user ****" \
|
|
# Create the user
|
|
&& groupadd --gid $GID $USERNAME \
|
|
&& useradd --uid $UID --gid $GID -m $USERNAME \
|
|
#
|
|
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
|
|
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
|
|
&& chmod 0440 /etc/sudoers.d/$USERNAME \
|
|
&& chown $USERNAME:$USERNAME /home/$USERNAME \
|
|
&& chown -R $USERNAME:$USERNAME /linuxgsm
|
|
|
|
HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /linuxgsm/*server monitor || exit 1
|
|
|
|
USER linuxgsm
|
|
## Download linuxgsm.sh
|
|
RUN echo "**** Download linuxgsm.sh ****" \
|
|
&& set -ex \
|
|
&& mkdir -p /linuxgsm/lgsm \
|
|
&& wget -O linuxgsm.sh "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${LGSM_GITHUBBRANCH}/linuxgsm.sh" \
|
|
&& chmod +x linuxgsm.sh
|
|
|
|
RUN echo "**** Get LinuxGSM Modules ****" \
|
|
&& git clone --filter=blob:none --no-checkout --sparse https://github.com/GameServerManagers/LinuxGSM.git \
|
|
&& cd LinuxGSM \
|
|
&& git sparse-checkout set --cone \
|
|
&& git sparse-checkout set lgsm/functions \
|
|
&& git checkout ${LGSM_GITHUBBRANCH} \
|
|
&& mkdir -p /linuxgsm/lgsm/functions \
|
|
&& mv lgsm/functions/* /linuxgsm/lgsm/functions \
|
|
&& chmod +x /linuxgsm/lgsm/functions/* \
|
|
&& rm -rf /linuxgsm/LinuxGSM
|
|
|
|
# Add LinuxGSM cronjobs
|
|
RUN echo "**** Create Cronjob ****"
|
|
RUN (crontab -l 2>/dev/null; echo "*/30 * * * * /linuxgsm/*server update > /dev/null 2>&1") | crontab -
|
|
|
|
ENTRYPOINT ["/init"]
|
|
CMD [ "./entrypoint.sh" ]
|
|
|