-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
244 lines (214 loc) · 8.22 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND="noninteractive"
ARG TIMEZONE="Etc/UTC"
ENV TZ="${TIMEZONE}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
tzdata \
&& ln -snf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
\
&& apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
cmake \
g++-14 \
git-core \
libboost-filesystem-dev \
libboost-program-options-dev \
libboost-regex-dev \
libboost-serialization-dev \
libboost-system-dev \
libboost-thread-dev \
libmariadb-dev-compat \
libssl-dev \
mariadb-client \
\
&& update-alternatives --install /usr/bin/gcc gcc \
/usr/bin/gcc-14 14 \
--slave /usr/bin/g++ g++ \
/usr/bin/g++-14 \
\
&& rm -rf /var/lib/apt/lists/* \
/tmp/*
ARG EXPANSION
ARG MANGOS_SHA1="latest"
ARG DATABASE_SHA1="latest"
ENV HOME_DIR="/home/mangos"
ENV MANGOS_DIR="${HOME_DIR}/mangos"
ENV DATABASE_DIR="${HOME_DIR}/${EXPANSION}-db"
RUN mkdir -p "${MANGOS_DIR}" \
"${DATABASE_DIR}" \
\
&& cd /tmp \
&& if [ "${MANGOS_SHA1}" = "latest" ]; \
then \
git clone "https://github.com/cmangos/mangos-${EXPANSION}.git" \
--branch "master" \
--single-branch \
--depth 1 \
"${MANGOS_DIR}"; \
else \
git clone "https://github.com/cmangos/mangos-${EXPANSION}.git" \
--branch "master" \
--single-branch \
cmangos-mangos \
&& cd cmangos-mangos \
&& git archive "${MANGOS_SHA1}" | tar xC "${MANGOS_DIR}"; \
fi \
\
&& cd /tmp \
&& if [ "${DATABASE_SHA1}" = "latest" ]; \
then \
git clone "https://github.com/cmangos/${EXPANSION}-db.git" \
--branch "master" \
--single-branch \
--depth 1 \
"${DATABASE_DIR}"; \
else \
git clone "https://github.com/cmangos/${EXPANSION}-db.git" \
--branch "master" \
--single-branch \
cmangos-db \
&& cd cmangos-db \
&& git archive "${DATABASE_SHA1}" | tar xC "${DATABASE_DIR}"; \
fi \
\
&& rm -rf /tmp/*
# TODO: Add here as building arguments all `cmake` parameters.
# - CMAKE_INSTALL_PREFIX Path where the server should be installed to
# - PCH Use precompiled headers
# - DEBUG Include additional debug-code in core
# - WARNINGS Show all warnings during compile
# - POSTGRESQL Use PostgreSQL instead of mysql
# - BUILD_EXTRACTORS Build map/dbc/vmap/mmap extractor
# - BUILD_SCRIPTDEV Build scriptdev. (Disable it to speedup build in dev mode by not including scripts)
# - BUILD_PLAYERBOTS Build Playerbot mod
# - BUILD_AHBOT Build Auction House Bot mod
# - BUILD_METRICS Build Metrics, generate data for Grafana
# - BUILD_RECASTDEMOMOD Build map/vmap/mmap viewer
# - BUILD_GIT_ID Build git_id
# - BUILD_DOCS Build documentation with doxygen
#
ARG THREADS="1"
RUN mkdir -p "${HOME_DIR}/build" \
"${HOME_DIR}/run" \
\
&& cd "${HOME_DIR}/build" \
&& cmake ../mangos/ \
-D CMAKE_INSTALL_PREFIX=../run \
-D PCH=1 \
-D DEBUG=0 \
-D BUILD_EXTRACTORS=ON \
&& make -j "${THREADS}" \
&& make install \
\
&& cd "${HOME_DIR}/run/bin/tools" \
&& chmod +x ExtractResources.sh \
MoveMapGen.sh
RUN useradd --comment "MaNGOS" \
--home "${HOME_DIR}" \
--user-group mangos
WORKDIR "${HOME_DIR}"
ENV MYSQL_SUPERUSER="root"
ENV MYSQL_SUPERPASS=""
ENV MANGOS_DBHOST="host.docker.internal"
ENV MANGOS_DBPORT="3306"
ENV MANGOS_DBUSER="mangos"
ENV MANGOS_DBPASS=""
ENV MANGOS_WORLD_DBNAME="${EXPANSION}mangos"
ENV MANGOS_CHARACTERS_DBNAME="${EXPANSION}characters"
ENV MANGOS_LOGS_DBNAME="${EXPANSION}logs"
ENV MANGOS_REALMD_DBNAME="${EXPANSION}realmd"
COPY builder/entrypoint.sh /
COPY builder/InstallFullDB.config "${DATABASE_DIR}/"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
ENV VOLUME_DIR="/home/mangos/data"
ENV TMPDIR="${VOLUME_DIR}/tmp"
VOLUME ["${VOLUME_DIR}"]
ARG COMMIT_SHA
ARG CREATE_DATE
ARG VERSION
LABEL org.opencontainers.image.title="CMaNGOS \"${EXPANSION}\" version"
LABEL org.opencontainers.image.description="A CMaNGOS \"${EXPANSION}\" version Docker image ready-to-use to host your emulated private server for WoW wherever you want."
LABEL org.opencontainers.image.licenses="GPL-2.0"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.revision="${COMMIT_SHA}"
LABEL org.opencontainers.image.source="https://github.com/Byloth/cmangos-docker"
LABEL org.opencontainers.image.url="https://github.com/Byloth/cmangos-docker"
LABEL org.opencontainers.image.authors="Matteo Bilotta <me@byloth.net>"
LABEL org.opencontainers.image.vendor="Bylothink"
LABEL org.opencontainers.image.created="${CREATE_DATE}"
LABEL "net.cmangos.mangos-${EXPANSION}.revision"="${MANGOS_SHA1}"
LABEL "net.cmangos.mangos-${EXPANSION}.source"="https://github.com/cmangos/mangos-${EXPANSION}"
LABEL "net.cmangos.mangos-${EXPANSION}.url"="https://github.com/cmangos/mangos-${EXPANSION}"
LABEL "net.cmangos.${EXPANSION}-db.revision"="${DATABASE_SHA1}"
LABEL "net.cmangos.${EXPANSION}-db.source"="https://github.com/cmangos/${EXPANSION}-db"
LABEL "net.cmangos.${EXPANSION}-db.url"="https://github.com/cmangos/${EXPANSION}-db"
FROM ubuntu:24.04 AS runner
ENV DEBIAN_FRONTEND="noninteractive"
ARG TIMEZONE="Etc/UTC"
ENV TZ="${TIMEZONE}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
tzdata \
&& ln -snf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
\
&& apt-get install -y --no-install-recommends \
gosu \
libmariadb-dev \
libssl3 \
wait-for-it \
\
&& rm -rf /var/lib/apt/lists/* \
/tmp/*
ENV HOME_DIR="/home/mangos"
ENV MANGOS_DIR="/opt/mangos"
RUN useradd --home "${HOME_DIR}" --create-home \
--comment "MaNGOS" \
--user-group mangos
WORKDIR "${MANGOS_DIR}"
ARG EXPANSION
COPY --from=builder "${HOME_DIR}/run" "${MANGOS_DIR}"
COPY runner/entrypoint.sh /
ENV VOLUME_DIR="/var/lib/mangos"
ENV TMPDIR="${VOLUME_DIR}/tmp"
RUN mkdir "${VOLUME_DIR}" \
&& sed -i '/^DataDir/c\DataDir = "'"${VOLUME_DIR}"'"' etc/mangosd.conf.dist
ENV MANGOS_DBHOST="host.docker.internal"
ENV MANGOS_DBPORT="3306"
ENV MANGOS_DBUSER="mangos"
ENV MANGOS_DBPASS=""
ENV MANGOS_WORLD_DBNAME="${EXPANSION}mangos"
ENV MANGOS_CHARACTERS_DBNAME="${EXPANSION}characters"
ENV MANGOS_LOGS_DBNAME="${EXPANSION}logs"
ENV MANGOS_REALMD_DBNAME="${EXPANSION}realmd"
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
EXPOSE 3443 3724 7878 8085 8086
VOLUME ["${VOLUME_DIR}"]
ARG COMMIT_SHA
ARG CREATE_DATE
ARG VERSION
LABEL org.opencontainers.image.title="CMaNGOS Runner \"${EXPANSION}\" version"
LABEL org.opencontainers.image.description="A CMaNGOS \"${EXPANSION}\" version Docker image ready-to-use to host your emulated private server for WoW wherever you want."
LABEL org.opencontainers.image.licenses="GPL-2.0"
LABEL org.opencontainers.image.version="${VERSION}"
LABEL org.opencontainers.image.revision="${COMMIT_SHA}"
LABEL org.opencontainers.image.source="https://github.com/Byloth/cmangos-docker"
LABEL org.opencontainers.image.url="https://github.com/Byloth/cmangos-docker"
LABEL org.opencontainers.image.authors="Matteo Bilotta <me@byloth.net>"
LABEL org.opencontainers.image.vendor="Bylothink"
LABEL org.opencontainers.image.created="${CREATE_DATE}"
ARG MANGOS_SHA1
LABEL "net.cmangos.mangos-${EXPANSION}.revision"="${MANGOS_SHA1}"
LABEL "net.cmangos.mangos-${EXPANSION}.source"="https://github.com/cmangos/mangos-${EXPANSION}"
LABEL "net.cmangos.mangos-${EXPANSION}.url"="https://github.com/cmangos/mangos-${EXPANSION}"
ARG DATABASE_SHA1
LABEL "net.cmangos.${EXPANSION}-db.revision"="${DATABASE_SHA1}"
LABEL "net.cmangos.${EXPANSION}-db.source"="https://github.com/cmangos/${EXPANSION}-db"
LABEL "net.cmangos.${EXPANSION}-db.url"="https://github.com/cmangos/${EXPANSION}-db"