forked from thijsvanloef/palworld-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
203 lines (180 loc) · 7.74 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
FROM golang:1.23.3-alpine AS rcon-cli_builder
ARG RCON_VERSION="0.10.3"
ARG RCON_TGZ_SHA1SUM=33ee8077e66bea6ee097db4d9c923b5ed390d583
WORKDIR /build
# install rcon
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
ENV CGO_ENABLED=0
RUN wget -q https://github.com/gorcon/rcon-cli/archive/refs/tags/v${RCON_VERSION}.tar.gz -O rcon.tar.gz \
&& echo "${RCON_TGZ_SHA1SUM}" rcon.tar.gz | sha1sum -c - \
&& tar -xzvf rcon.tar.gz \
&& rm rcon.tar.gz \
&& mv rcon-cli-${RCON_VERSION}/* ./ \
&& rm -rf rcon-cli-${RCON_VERSION} \
&& go build -v ./cmd/gorcon
FROM cm2network/steamcmd:root AS base-amd64
# Ignoring --platform=arm64 as this is required for the multi-arch build to continue to work on amd64 hosts
# hadolint ignore=DL3029
FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-11-17 AS base-arm64
ARG TARGETARCH
# Ignoring the lack of a tag here because the tag is defined in the above FROM lines
# and hadolint isn't aware of those.
# hadolint ignore=DL3006
FROM base-${TARGETARCH}
LABEL maintainer="thijs@loef.dev" \
name="thijsvanloef/palworld-server-docker" \
github="https://github.com/thijsvanloef/palworld-server-docker" \
dockerhub="https://hub.docker.com/r/thijsvanloef/palworld-server-docker" \
org.opencontainers.image.authors="Thijs van Loef" \
org.opencontainers.image.source="https://github.com/thijsvanloef/palworld-server-docker"
# set envs
# SUPERCRONIC: Latest releases available at https://github.com/aptible/supercronic/releases
# RCON: Latest releases available at https://github.com/gorcon/rcon-cli/releases
# DEPOT_DOWNLOADER: Latest releases available at https://github.com/SteamRE/DepotDownloader/releases
# NOTICE: edit RCON_MD5SUM SUPERCRONIC_SHA1SUM when using binaries of another version or arch.
ARG SUPERCRONIC_SHA1SUM_ARM64="e0f0c06ebc5627e43b25475711e694450489ab00 "
ARG SUPERCRONIC_SHA1SUM_AMD64="71b0d58cc53f6bd72cf2f293e09e294b79c666d8 "
ARG SUPERCRONIC_VERSION="0.2.33"
ARG DEPOT_DOWNLOADER_VERSION="2.7.3"
# update and install dependencies
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends \
procps=2:4.0.2-3 \
wget \
gettext-base=0.21-12 \
xdg-user-dirs=0.18-1 \
jo=1.9-1 \
jq=1.6-2.1 \
netcat-traditional=1.10-47 \
libicu72=72.1-3 \
unzip=6.0-28 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install rcon and supercronic
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY --from=rcon-cli_builder /build/gorcon /usr/bin/rcon-cli
ARG TARGETARCH
RUN case "${TARGETARCH}" in \
"amd64") SUPERCRONIC_SHA1SUM=${SUPERCRONIC_SHA1SUM_AMD64} ;; \
"arm64") SUPERCRONIC_SHA1SUM=${SUPERCRONIC_SHA1SUM_ARM64} ;; \
esac \
&& wget --progress=dot:giga "https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-${TARGETARCH}" -O supercronic \
&& echo "${SUPERCRONIC_SHA1SUM}" supercronic | sha1sum -c - \
&& chmod +x supercronic \
&& mv supercronic /usr/local/bin/supercronic
RUN case "${TARGETARCH}" in \
"amd64") DEPOT_DOWNLOADER_FILENAME=DepotDownloader-linux-x64.zip ;; \
"arm64") DEPOT_DOWNLOADER_FILENAME=DepotDownloader-linux-arm64.zip ;; \
esac \
&& wget --progress=dot:giga "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_${DEPOT_DOWNLOADER_VERSION}/${DEPOT_DOWNLOADER_FILENAME}" -O DepotDownloader.zip \
&& unzip DepotDownloader.zip \
&& rm -rf DepotDownloader.xml \
&& chmod +x DepotDownloader \
&& mv DepotDownloader /usr/local/bin/DepotDownloader
# hadolint ignore=DL3044
ENV HOME=/home/steam \
PORT= \
PUID=1000 \
PGID=1000 \
PLAYERS= \
MULTITHREADING=false \
COMMUNITY=false \
PUBLIC_IP= \
PUBLIC_PORT= \
SERVER_PASSWORD= \
SERVER_NAME= \
ADMIN_PASSWORD= \
UPDATE_ON_BOOT=true \
RCON_ENABLED=true \
RCON_PORT=25575 \
QUERY_PORT=27015 \
REST_API_PORT=8212 \
TZ=UTC \
SERVER_DESCRIPTION= \
BACKUP_ENABLED=true \
DELETE_OLD_BACKUPS=false \
OLD_BACKUP_DAYS=30 \
BACKUP_CRON_EXPRESSION="0 0 * * *" \
AUTO_UPDATE_ENABLED=false \
AUTO_UPDATE_CRON_EXPRESSION="0 * * * *" \
AUTO_UPDATE_WARN_MINUTES=30 \
AUTO_REBOOT_ENABLED=false \
AUTO_REBOOT_WARN_MINUTES=5 \
AUTO_REBOOT_EVEN_IF_PLAYERS_ONLINE=false \
AUTO_REBOOT_CRON_EXPRESSION="0 0 * * *" \
DISCORD_SUPPRESS_NOTIFICATIONS= \
DISCORD_WEBHOOK_URL= \
DISCORD_CONNECT_TIMEOUT=30 \
DISCORD_MAX_TIMEOUT=30 \
DISCORD_PRE_UPDATE_BOOT_MESSAGE="Server is updating..." \
DISCORD_PRE_UPDATE_BOOT_MESSAGE_URL= \
DISCORD_PRE_UPDATE_BOOT_MESSAGE_ENABLED=true \
DISCORD_POST_UPDATE_BOOT_MESSAGE="Server update complete!" \
DISCORD_POST_UPDATE_BOOT_MESSAGE_URL= \
DISCORD_POST_UPDATE_BOOT_MESSAGE_ENABLED=true \
DISCORD_PRE_START_MESSAGE="Server has been started!" \
DISCORD_PRE_START_MESSAGE_URL= \
DISCORD_PRE_START_MESSAGE_ENABLED=true \
DISCORD_PRE_SHUTDOWN_MESSAGE="Server is shutting down..." \
DISCORD_PRE_SHUTDOWN_MESSAGE_URL= \
DISCORD_PRE_SHUTDOWN_MESSAGE_ENABLED=true \
DISCORD_POST_SHUTDOWN_MESSAGE="Server has been stopped!" \
DISCORD_POST_SHUTDOWN_MESSAGE_URL= \
DISCORD_POST_SHUTDOWN_MESSAGE_ENABLED=true \
DISCORD_PLAYER_JOIN_MESSAGE="player_name has joined Palworld!" \
DISCORD_PLAYER_JOIN_MESSAGE_URL= \
DISCORD_PLAYER_JOIN_MESSAGE_ENABLED=true \
DISCORD_PLAYER_LEAVE_MESSAGE="player_name has left Palworld." \
DISCORD_PLAYER_LEAVE_MESSAGE_URL= \
DISCORD_PLAYER_LEAVE_MESSAGE_ENABLED=true \
DISCORD_PRE_BACKUP_MESSAGE="Creating backup..." \
DISCORD_PRE_BACKUP_MESSAGE_URL= \
DISCORD_PRE_BACKUP_MESSAGE_ENABLED=true \
DISCORD_POST_BACKUP_MESSAGE="Backup created at file_path" \
DISCORD_POST_BACKUP_MESSAGE_URL= \
DISCORD_POST_BACKUP_MESSAGE_ENABLED=true \
DISCORD_PRE_BACKUP_DELETE_MESSAGE="Removing backups older than old_backup_days days" \
DISCORD_PRE_BACKUP_DELETE_MESSAGE_URL= \
DISCORD_PRE_BACKUP_DELETE_MESSAGE_ENABLED=true \
DISCORD_POST_BACKUP_DELETE_MESSAGE="Removed backups older than old_backup_days days" \
DISCORD_POST_BACKUP_DELETE_MESSAGE_URL= \
DISCORD_POST_BACKUP_DELETE_MESSAGE_ENABLED=true \
DISCORD_ERR_BACKUP_DELETE_MESSAGE="Unable to delete old backups, OLD_BACKUP_DAYS is not an integer. OLD_BACKUP_DAYS=old_backup_days" \
DISCORD_ERR_BACKUP_DELETE_MESSAGE_URL= \
DISCORD_ERR_BACKUP_DELETE_MESSAGE_ENABLED=true \
ENABLE_PLAYER_LOGGING=true \
PLAYER_LOGGING_POLL_PERIOD=5 \
ARM64_DEVICE=generic \
DISABLE_GENERATE_ENGINE=true \
ALLOW_CONNECT_PLATFORM=Steam \
USE_DEPOT_DOWNLOADER=false \
INSTALL_BETA_INSIDER=false
# Sane Box64 config defaults
# hadolint ignore=DL3044
ENV BOX64_DYNAREC_STRONGMEM=1 \
BOX64_DYNAREC_BIGBLOCK=1 \
BOX64_DYNAREC_SAFEFLAGS=1 \
BOX64_DYNAREC_FASTROUND=1 \
BOX64_DYNAREC_FASTNAN=1 \
BOX64_DYNAREC_X87DOUBLE=0
# Passed from Github Actions
ARG GIT_VERSION_TAG=unspecified
COPY ./scripts /home/steam/server/
RUN chmod +x /home/steam/server/*.sh && \
mv /home/steam/server/backup.sh /usr/local/bin/backup && \
mv /home/steam/server/update.sh /usr/local/bin/update && \
mv /home/steam/server/restore.sh /usr/local/bin/restore && \
ln -sf /home/steam/server/rest_api.sh /usr/local/bin/rest-cli
WORKDIR /home/steam/server
# Make GIT_VERSION_TAG file to be able to check the version
RUN echo $GIT_VERSION_TAG > GIT_VERSION_TAG
RUN touch rcon.yaml crontab && \
mkdir -p /home/steam/Steam/package && \
chown steam:steam /home/steam/Steam/package && \
rm -rf /tmp/dumps && \
chmod o+w rcon.yaml crontab /home/steam/Steam/package && \
chown steam:steam -R /home/steam/server
HEALTHCHECK --start-period=5m \
CMD pgrep "PalServer-Linux" > /dev/null || exit 1
EXPOSE ${PORT} ${RCON_PORT}
ENTRYPOINT ["/home/steam/server/init.sh"]