forked from ceifa/garrysmod-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.x64
89 lines (70 loc) · 2.6 KB
/
Dockerfile.x64
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
# BASE IMAGE
FROM debian:buster-slim
LABEL maintainer="Clueliss"
LABEL description="A structured Garry's Mod dedicated server under a debian linux image"
ENV DEBIAN_FRONTEND="noninteractive"
# INSTALL NECESSARY PACKAGES
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get -y --no-install-recommends --no-install-suggests install \
psmisc wget ca-certificates tar gcc g++ libgcc1 libssl1.1 libtinfo5 lib32z1 gdb libsdl1.2debian libfontconfig
# CLEAN UP
RUN apt-get clean
RUN rm -rf /tmp/* /var/lib/apt/lists/*
# CREATE STEAM USER
RUN useradd --no-create-home steam
RUN mkdir -p /home/gmod/server && mkdir /home/gmod/steamcmd
# INSTALL STEAMCMD
RUN wget -P /home/gmod/steamcmd/ https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz \
&& tar -xvzf /home/gmod/steamcmd/steamcmd_linux.tar.gz -C /home/gmod/steamcmd \
&& rm -rf /home/gmod/steamcmd/steamcmd_linux.tar.gz
# SETUP STEAMCMD TO DOWNLOAD GMOD SERVER
RUN /home/gmod/steamcmd/steamcmd.sh \
+login anonymous \
+force_install_dir /home/gmod/server \
+app_update 4020 -beta x86-64 validate \
+quit
# SETUP CSS CONTENT
RUN /home/gmod/steamcmd/steamcmd.sh +login anonymous \
+force_install_dir /home/gmod/temp \
+app_update 232330 validate \
+quit
RUN mkdir /home/gmod/mounts && mv /home/gmod/temp/cstrike /home/gmod/mounts/cstrike
RUN rm -rf /home/gmod/temp
# SETUP BINARIES FOR x64 bits
RUN mkdir -p /home/gmod/.steam/sdk64 \
&& cp -v /home/gmod/steamcmd/linux64/steamclient.so /home/gmod/.steam/sdk64/steamclient.so
# SET GMOD MOUNT CONTENT
RUN echo '"mountcfg" {"cstrike" "/home/gmod/mounts/cstrike"}' > /home/gmod/server/garrysmod/cfg/mount.cfg
# CREATE DATABASE FILE
RUN touch /home/gmod/server/garrysmod/sv.db
# CREATE CACHE FOLDERS
RUN mkdir -p /home/gmod/server/steam_cache/content && mkdir -p /home/gmod/server/garrysmod/cache/srcds
# USER ID AND GROUP ID
ENV PGID="0"
ENV PUID="0"
# PORT FORWARDING
# https://developer.valvesoftware.com/wiki/Source_Dedicated_Server#Connectivity
EXPOSE 27015
EXPOSE 27015/udp
EXPOSE 27005/udp
# SET ENVIRONMENT VARIABLES
ENV MAXPLAYERS="16"
ENV GAMEMODE="sandbox"
ENV MAP="gm_construct"
ENV PORT="27015"
ENV CLIENTPORT="27005"
# ADD INIT SCRIPT
COPY assets/init.sh /home/gmod/init.sh
RUN chmod +x /home/gmod/init.sh
# ADD START SCRIPT
COPY assets/start-x64.sh /home/gmod/start.sh
RUN chmod +x /home/gmod/start.sh
# CREATE HEALTH CHECK
COPY assets/health.sh /home/gmod/health.sh
RUN chmod +x /home/gmod/health.sh
HEALTHCHECK --start-period=10s \
CMD /home/gmod/health.sh
# START THE SERVER
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["/home/gmod/init.sh", "/home/gmod/start-x64.sh"]