Browse Source

optimise

pull/5/head
Daniel Gibbs 3 years ago
parent
commit
fc377311f5
No known key found for this signature in database GPG Key ID: 4D812BAB6228BBA6
  1. 133
      Dockerfile

133
Dockerfile

@ -15,59 +15,62 @@ USER root
## Install Base LinuxGSM Requirements ## Install Base LinuxGSM Requirements
RUN echo "**** Install Base LinuxGSM Requirements ****" \ RUN echo "**** Install Base LinuxGSM Requirements ****" \
&& apt-get update \ && apt-get update \
&& apt-get install -y software-properties-common \ && apt-get install -y software-properties-common \
&& add-apt-repository multiverse \ && add-apt-repository multiverse \
&& apt-get update \ && apt-get update \
&& apt-get install -y \ && apt-get install -y \
cron \ cron \
bc \ bc \
binutils \ binutils \
bsdmainutils \ bsdmainutils \
bzip2 \ bzip2 \
ca-certificates \ ca-certificates \
cpio \ cpio \
curl \ curl \
distro-info \ distro-info \
file \ file \
git \ git \
gzip \ gzip \
hostname \ hostname \
jq \ jq \
lib32gcc-s1 \ lib32gcc-s1 \
lib32stdc++6 \ lib32stdc++6 \
netcat \ netcat \
python3 \ python3 \
sudo \ sudo \
tar \ tar \
tini \ tini \
tmux \ tmux \
unzip \ unzip \
util-linux \ util-linux \
wget \ wget \
xz-utils \ xz-utils \
# Docker Extras # Docker Extras
iproute2 \ iproute2 \
iputils-ping \ iputils-ping \
nano \ nano \
vim vim \
&& apt-get -y autoremove \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/*
# Install NodeJS # Install NodeJS
RUN echo "**** Install NodeJS ****" \ RUN echo "**** Install NodeJS ****" \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \ && curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get update && apt-get install -y nodejs && 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 # Install GameDig https://docs.linuxgsm.com/requirements/gamedig
RUN echo "**** Install GameDig ****" \ RUN echo "**** Install GameDig ****" \
&& npm install -g gamedig && npm install -g gamedig
# Install Cleanup
RUN echo "**** Cleanup ****" \
&& apt-get -y autoremove \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/*
##Need use xterm for LinuxGSM## ##Need use xterm for LinuxGSM##
@ -79,20 +82,20 @@ ARG USER_GID=$USER_UID
## Add linuxgsm user ## Add linuxgsm user
RUN echo "**** Add linuxgsm user ****" \ RUN echo "**** Add linuxgsm user ****" \
# Create the user # Create the user
&& groupadd --gid $USER_GID $USERNAME \ && groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
# #
# [Optional] Add sudo support. Omit if you don't need to install software after connecting. # [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 \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown $USERNAME:$USERNAME /home/$USERNAME && chown $USERNAME:$USERNAME /home/$USERNAME
## Download linuxgsm.sh ## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \ RUN echo "**** Download linuxgsm.sh ****" \
&& set -ex \ && set -ex \
&& wget -O linuxgsm.sh https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/linuxgsm.sh \ && wget -O linuxgsm.sh https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/linuxgsm.sh \
&& chmod +x /linuxgsm.sh && chmod +x /linuxgsm.sh
WORKDIR /home/linuxgsm WORKDIR /home/linuxgsm
ENV PATH=$PATH:/home/linuxgsm ENV PATH=$PATH:/home/linuxgsm
@ -102,13 +105,13 @@ USER linuxgsm
RUN steamcmd +quit RUN steamcmd +quit
RUN git clone --filter=blob:none --no-checkout --depth 1 --sparse https://github.com/GameServerManagers/LinuxGSM.git; \ RUN git clone --filter=blob:none --no-checkout --depth 1 --sparse https://github.com/GameServerManagers/LinuxGSM.git; \
cd LinuxGSM; \ cd LinuxGSM; \
git sparse-checkout set lgsm/functions; \ git sparse-checkout set lgsm/functions; \
git checkout; \ git checkout; \
mkdir -p /home/linuxgsm/lgsm/functions; \ mkdir -p /home/linuxgsm/lgsm/functions; \
mv lgsm/functions/* /home/linuxgsm/lgsm/functions; \ mv lgsm/functions/* /home/linuxgsm/lgsm/functions; \
chmod +x /home/linuxgsm/lgsm/functions/*; \ chmod +x /home/linuxgsm/lgsm/functions/*; \
rm -rf /home/linuxgsm/LinuxGSM rm -rf /home/linuxgsm/LinuxGSM
# Add LinuxGSM cronjobs # Add LinuxGSM cronjobs
RUN (crontab -l 2>/dev/null; echo "*/1 * * * * /home/linuxgsm/*server monitor > /dev/null 2>&1") | crontab - RUN (crontab -l 2>/dev/null; echo "*/1 * * * * /home/linuxgsm/*server monitor > /dev/null 2>&1") | crontab -

Loading…
Cancel
Save