-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile.ubuntu-2204
140 lines (125 loc) · 3.68 KB
/
Dockerfile.ubuntu-2204
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
134
135
136
137
138
139
140
#
# LinuxGSM Base Dockerfile
#
# https://github.com/GameServerManagers/docker-linuxgsm
#
FROM gameservermanagers/steamcmd:ubuntu-22.04
LABEL maintainer="LinuxGSM <me@danielgibbs.co.uk>"
ENV DEBIAN_FRONTEND noninteractive
ENV TERM=xterm
ENV LGSM_GITHUBUSER=GameServerManagers
ENV LGSM_GITHUBREPO=LinuxGSM
ENV LGSM_GITHUBBRANCH=master
ENV LGSM_LOGDIR=/data/log
ENV LGSM_SERVERFILES=/data/serverfiles
ENV LGSM_DATADIR=/data/data
ENV LGSM_CONFIG=/data/config-lgsm
ENV LGSM_DEV=false
ENV GAMESERVER=jc2server
ENV VALIDATE_ON_START=false
ENV UPDATE_CHECK=60
ENV USER=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 \
bc \
binutils \
bsdmainutils \
bzip2 \
ca-certificates \
cpio \
cron \
curl \
distro-info \
file \
git \
gnupg \
gosu \
gzip \
hostname \
jq \
lib32gcc-s1 \
lib32stdc++6 \
netcat \
python3 \
sudo \
tar \
tmux \
unzip \
util-linux \
uuid-runtime \
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 ****" \
&& set -uex \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& NODE_MAJOR=20 \
&& echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install nodejs -y \
&& apt-get -y autoremove \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/* \
&& npm install -g npm@latest
# Install GameDig https://docs.linuxgsm.com/requirements/gamedig
RUN echo "**** Install GameDig ****" \
&& npm install -g gamedig@5
WORKDIR /app
## Add linuxgsm user
RUN echo "**** Add linuxgsm user ****" \
&& mkdir /data \
# Create the user
&& groupadd --gid $GID $USER \
&& useradd --uid $UID --gid $GID -m $USER \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& echo $USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USER \
&& chmod 0440 /etc/sudoers.d/$USER \
&& chown $USER:$USER /data
HEALTHCHECK --interval=1m --timeout=1m --start-period=2m --retries=1 CMD /app/entrypoint-healthcheck.sh || exit 1
## Download linuxgsm.sh
RUN echo "**** Download linuxgsm.sh ****" \
&& set -ex \
&& curl -Lo 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/modules \
&& git checkout ${LGSM_GITHUBBRANCH} \
&& mkdir -p /app/lgsm/modules \
&& mv lgsm/modules/* /app/lgsm/modules \
&& chmod +x /app/lgsm/modules/* \
&& cd ../ \
&& rm -rf LinuxGSM \
&& chown -R $USER:$USER /app
ARG CACHEBUST=1
RUN echo "$CACHEBUST"
COPY entrypoint.sh /app/entrypoint.sh
COPY entrypoint-user.sh /app/entrypoint-user.sh
COPY entrypoint-healthcheck.sh /app/entrypoint-healthcheck.sh
RUN date > /build-time.txt
ENTRYPOINT ["/bin/bash", "./entrypoint.sh"]