This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Dockerfile
133 lines (113 loc) · 3.53 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# LinuxGSM Base Dockerfile
#
# https://github.com/GameServerManagers/LinuxGSM-Docker
#
FROM ubuntu:20.04
LABEL maintainer="LinuxGSM <[email protected]>"
ENV DEBIAN_FRONTEND noninteractive
ENV TERM=xterm
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install UTF-8 unicode
RUN echo "**** Install UTF-8 ****" \
&& apt-get update \
&& apt-get install -y locales apt-utils debconf-utils
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
## Upgrade Ubuntu
RUN echo "**** apt upgrade ****" \
&& apt-get update; \
apt-get upgrade -y
## Install Base LinuxGSM Requirements
RUN echo "**** Install Base LinuxGSM Requirements ****" \
&& apt-get update \
&& apt-get install -y software-properties-common \
&& add-apt-repository multiverse \
&& apt-get update \
&& apt-get install -y \
bc \
binutils \
bsdmainutils \
bzip2 \
ca-certificates \
cron \
cpio \
curl \
distro-info \
file \
gzip \
hostname \
jq \
lib32gcc1 \
lib32stdc++6 \
netcat \
python3 \
tar \
tmux \
unzip \
util-linux \
wget \
xz-utils \
# Docker Extras
cron \
iproute2 \
iputils-ping \
nano \
vim \
sudo \
tini
# Install SteamCMD
RUN echo "**** Install SteamCMD ****" \
&& echo steam steam/question select "I AGREE" | debconf-set-selections \
&& echo steam steam/license note '' | debconf-set-selections \
&& dpkg --add-architecture i386 \
&& apt-get update -y \
&& apt-get install -y --no-install-recommends libsdl2-2.0-0:i386 steamcmd \
&& ln -s /usr/games/steamcmd /usr/bin/steamcmd
# Install NodeJS
RUN echo "**** Install NodeJS ****" \
&& curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get update && apt-get install -y nodejs
# Install GameDig https://docs.linuxgsm.com/requirements/gamedig
RUN echo "**** Install 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##
ENV DEBIAN_FRONTEND noninteractive
ARG USERNAME=linuxgsm
ARG USER_UID=1000
ARG USER_GID=$USER_UID
## Add linuxgsm user
RUN echo "**** Add linuxgsm user ****" \
# Create the user
&& groupadd --gid $USER_GID $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.
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown $USERNAME:$USERNAME /home/$USERNAME
# Create /opt/linuxgsm
#RUN echo "**** Create /opt/linuxgsm ****" \
# && mkdir -p /opt/linuxgsm \
# && chown linuxgsm:linuxgsm /opt/linuxgsm
## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \
&& set -ex \
&& wget -O linuxgsm.sh https://linuxgsm.sh \
&& chmod +x /linuxgsm.sh
WORKDIR /home/linuxgsm
ENV PATH=$PATH:/home/linuxgsm
USER linuxgsm
# Add LinuxGSM cronjobs
RUN (crontab -l 2>/dev/null; echo "*/5 * * * * /home/linuxgsm/*server monitor > /dev/null 2>&1") | crontab -
RUN (crontab -l 2>/dev/null; echo "*/30 * * * * /home/linuxgsm/*server update > /dev/null 2>&1") | crontab -
RUN (crontab -l 2>/dev/null; echo "0 1 * * 0 /home/linuxgsm/*server update-lgsm > /dev/null 2>&1") | crontab -
COPY entrypoint.sh /home/linuxgsm/entrypoint.sh
ENTRYPOINT [ "/usr/bin/tini", "--" ]
CMD [ "bash","./entrypoint.sh" ]