-
Notifications
You must be signed in to change notification settings - Fork 16
/
docker-compose.yml
80 lines (79 loc) · 3.05 KB
/
docker-compose.yml
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
volumes:
lgsm:
services:
lgsm:
# Limiting server resources
cpu_count: 2
mem_limit: 8gb
# other stuf
init: true
user: root
image: gameservermanagers/linuxgsm-docker
# Do not change this from restart: always. Maintenance scripts assume
# docker-compose auto restarts the rust server.
restart: always
command:
- /bin/bash
- -exc
- |
# MAIN
apt-get update
apt-get install -y dos2unix rsync sudo vim nano libgdiplus python3.8-venv lib32z1
#grant access to video card for direct rendering (not used by rust ds)
#function get_video_gid() {
# find /dev/dri -maxdepth 1 -type c | head -n1 | xargs stat -c %g
#}
#function get_video_group() {
# local gid="$$(get_video_gid)"
# awk -v gid="$$gid" -F: '$$3 == gid { print $$1 }' /etc/group
#}
#vid="$$(get_video_group)"
#if [ -z "$$vid" ]; then
# groupadd -g "$$(get_video_gid)" videocard
# vid=videocard
#fi
#usermod -a -G "$$vid" linuxgsm
# grant temporary sudo access for initial setup
echo 'linuxgsm ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers.d/lgsm
lgsm_uid="$$(id -u linuxgsm)"
lgsm_gid="$$(id -g linuxgsm)"
if [ ! "$$lgsm_uid" = 1000 ]; then
sed -i "s/:$$lgsm_uid:$$lgsm_gid:/:1000:1000:/" /etc/passwd
sed -i "s/:$$lgsm_gid:/:1000:/" /etc/group
fi
if [ ! "$$(stat -c '%U' /home/linuxgsm)" = linuxgsm ]; then
chown -R linuxgsm: /home/linuxgsm
fi
if [ ! "$$(stat -c '%U' /custom-maps)" = linuxgsm ]; then
chown -R linuxgsm: /custom-maps
fi
python3 -m venv /home/linuxgsm/.venv
grep -F .venv ~linuxgsm/.bash_profile || echo 'source /home/linuxgsm/.venv/bin/activate' > ~linuxgsm/.bash_profile
grep -F .venv ~linuxgsm/.bashrc || echo 'source /home/linuxgsm/.venv/bin/activate' > ~linuxgsm/.bashrc
if [ ! "$$(stat -c '%U' /home/linuxgsm/.venv)" = linuxgsm ]; then
chown -R linuxgsm: /home/linuxgsm/.venv
fi
chown linuxgsm: /home/linuxgsm /home/linuxgsm/serverfiles /home/linuxgsm/serverfiles/oxide
chown -R linuxgsm: /home/linuxgsm/serverfiles/oxide/config
rm -f ~linuxgsm/linuxgsm.sh
su - linuxgsm -c "LINUX_GSM_VERSION=\"${LINUX_GSM_VERSION:-v20.4.1}\" /utils/custom-rust-server.sh"
volumes:
- lgsm:/home/linuxgsm
- ./mod-configs/:/home/linuxgsm/serverfiles/oxide/config/:rw
- ./custom-mods/:/custom-plugins/:ro
- ./custom-maps/:/custom-maps/:rw
- ./harmony-mods:/home/linuxgsm/serverfiles/HarmonyMods
- ./harmony-config:/home/linuxgsm/serverfiles/HarmonyConfig
- ./utils/:/utils/:ro
- ./rust-environment.sh:/rust-environment.sh:ro
ports:
- ${RUST_RCON_INTERFACE:-127.0.0.1}:28016:28016
- 0.0.0.0:28015:28015/udp
- 0.0.0.0:8000:8000/tcp
healthcheck:
test: ["CMD", "pgrep", "RustDedicated"]
interval: 10s
retries: 3
start_period: 15m
# devices:
# - /dev/dri:/dev/dri